Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for addon (Generic Setup) management #505

Open
ericof opened this issue May 15, 2023 · 0 comments
Open

Implement support for addon (Generic Setup) management #505

ericof opened this issue May 15, 2023 · 0 comments
Assignees

Comments

@ericof
Copy link
Sponsor Member

ericof commented May 15, 2023

api.addon.get_addons

Return a list of addons (plone.api.addon.AddonInformation) in the installation.

Example:

from plone import api
from plone.api.addon import AddonInformation


addons = api.addon.get_addons()

# List of AddonInformation
assert isinstance(addons, list)
assert isinstance(addons[0], AddonInformation)

It is possible to filter the addons using the parameter limit:

from plone import api


# Return all valid addons
all_addons = api.addon.get_addons()

# Only installed addons
installed_addons = api.addon.get_addons(limit="installed")

# Only upgradable (already installed) addons
upgradable_addons = api.addon.get_addons(limit="upgradable")

# Available addons -- not installed
available_addons = api.addon.get_addons(limit="available")

# It is also possible to get addons not available in the UI
# Only broken addons (with installation problems)
broken_addons = api.addon.get_addons(limit="broken")

# Only non-installable addons
broken_addons = api.addon.get_addons(limit="non_installable")

api.addon.get_addons_ids

Similar to api.addon.get_addons, but return only the addon ids.

Example:

from plone import api


addons_ids = api.addon.get_addons_ids()

# List of str
assert isinstance(addons_ids, list)
assert isinstance(addons_ids[0], str)

api.addon.get

Get information about one addon.

Example:

from plone import api


# Get information about plone.restapi
addon = api.addon.get("plone.restapi")
assert addon.id, "plone.restapi"
assert addon.valid is True
assert addon.description == "RESTful hypermedia API for Plone."
assert addon.profile_type == "default"
assert addon.version == "8.21.0"

api.addon.install

Install an addon

Example:

from plone import api


status = api.addon.install("plone.restapi")
assert status is True
assert "plone.restapi" in api.addon.get_addons_ids(limit="installed")

api.addon.uninstall

Uninstall an addon

Example:

from plone import api


status = api.addon.uninstall("plone.restapi")
assert status is True
assert "plone.restapi" in api.addon.get_addons_ids(limit="available")
@ericof ericof self-assigned this May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant