Skip to content

Commit

Permalink
Merge pull request #6 from eea/develop
Browse files Browse the repository at this point in the history
Develop #153089
  • Loading branch information
alecghica authored Aug 29, 2022
2 parents de8532e + 470c5a1 commit 02f397f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.4 - (2022-08-29)
---------------------------
* Change: Changed how eea.banner gets STATIC/DYNAMIC env vars
[iulianpetchesi #153089]

1.3 - (2022-02-17)
---------------------------
* Change: Fix api when addon not installed
Expand Down
10 changes: 8 additions & 2 deletions eea/banner/restapi/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from six.moves import urllib
from plone import api
from plone.restapi.services import Service
from zope.component.hooks import getSite
from zope.interface import implementer
from zope.publisher.interfaces import IPublishTraverse

Expand Down Expand Up @@ -72,20 +73,25 @@ def reply(self):
"dynamic_banner": {"enabled": False},
}
development = self.request.form.get("development")

dynamic_banner_env = "DYNAMIC_BANNER_ENABLED_" + getSite().getId()
dynamic_banner_enabled = isTrue(
os.getenv("DYNAMIC_BANNER_ENABLED", False)
os.getenv(dynamic_banner_env, False)
) or api.portal.get_registry_record(
"dynamic_banner_enabled",
interface=IBannerSettings,
default=False,
)

static_banner_env = "STATIC_BANNER_ENABLED_" + getSite().getId()
static_banner_enabled = isTrue(
os.getenv("STATIC_BANNER_ENABLED", False)
os.getenv(static_banner_env, False)
) or api.portal.get_registry_record(
"static_banner_enabled",
interface=IBannerSettings,
default=False,
)

return {
"static_banner": {
"enabled": static_banner_enabled,
Expand Down
2 changes: 1 addition & 1 deletion eea/banner/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3
1.4

0 comments on commit 02f397f

Please sign in to comment.