diff --git a/instance.yaml b/instance.yaml index 41660c0..1347d29 100644 --- a/instance.yaml +++ b/instance.yaml @@ -2,7 +2,6 @@ default_context: initial_user_name: 'admin' initial_user_password: 'admin' - load_zcml: - package_includes: ['plone.distribution'] + zcml_package_includes: ['plone.distribution'] db_storage: direct diff --git a/news/60.bugfix b/news/60.bugfix new file mode 100644 index 0000000..98d4481 --- /dev/null +++ b/news/60.bugfix @@ -0,0 +1 @@ +Get the name of the existing distribution from the report, not the answers [@ericof] diff --git a/src/plone/distribution/api/distribution.py b/src/plone/distribution/api/distribution.py index 28cc267..1bd98fb 100644 --- a/src/plone/distribution/api/distribution.py +++ b/src/plone/distribution/api/distribution.py @@ -6,6 +6,7 @@ from plone.distribution.registry import DistributionRegistry from Products.CMFPlone.Portal import PloneSite from typing import List +from typing import Optional from typing import Union from zope.annotation.interfaces import IAnnotations @@ -82,13 +83,13 @@ def get_creation_report(site: PloneSite) -> Union[SiteCreationReport, None]: return annotations.get(SITE_REPORT_ANNO, None) -def get_current_distribution(site: PloneSite = None) -> Distribution: +def get_current_distribution(site: PloneSite = None) -> Optional[Distribution]: """Get the distribution used to create the current site.""" if site is None: site = api.portal.get() creation_report = get_creation_report(site) dist = None if creation_report: - name = creation_report.answers.get("distribution", "") + name = creation_report.name or creation_report.answers.get("distribution", "") dist = get(name=name) return dist