Skip to content

Commit

Permalink
fix hostnameBlacklist (Theming ControlPanel) in Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Apr 21, 2020
1 parent 6edf346 commit d6db78d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/plone/app/theming/browser/controlpanel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
<div
tal:define="error errors/hostnameBlacklist | nothing;
hostnameBlacklist view/theme_settings/hostnameBlacklist | python:[];
hostnameBlacklist python:request.get('hostnameBlacklist', hostnameBlacklist)"
hostnameBlacklist python: view.hostname_blacklist or hostnameBlacklist"
tal:attributes="class python:'field error' if error else 'field'">

<label for="hostnameBlacklist" i18n:translate="label_hostname_blacklist">Unthemed host names</label>
Expand All @@ -481,7 +481,7 @@
id="hostnameBlacklist"
rows="5"
cols="50"
tal:content="python:'\n'.join(hostnameBlacklist)"
tal:content="python: '\n'.join(hostnameBlacklist)"
></textarea>

</div>
Expand Down
10 changes: 6 additions & 4 deletions src/plone/app/theming/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def site_url(self):
"""
return getSite().absolute_url()

@property
def hostname_blacklist(self):
hostname_blacklist = self.request.get('hostnameBlacklist', [])
return [host.decode() for host in hostname_blacklist]

def __call__(self):
self.pskin = getToolByName(self.context, 'portal_skins')

Expand Down Expand Up @@ -165,8 +170,6 @@ def update(self):
prefix = form.get('absolutePrefix', None)
doctype = str(form.get('doctype', ""))

hostnameBlacklist = form.get('hostnameBlacklist', [])

parameterExpressions = {}
parameterExpressionsList = form.get('parameterExpressions', [])

Expand Down Expand Up @@ -200,8 +203,7 @@ def update(self):
self.theme_settings.rules = rules
self.theme_settings.absolutePrefix = prefix
self.theme_settings.parameterExpressions = parameterExpressions
self.theme_settings.hostnameBlacklist = [
str(bl) for bl in hostnameBlacklist]
self.theme_settings.hostnameBlacklist = self.hostname_blacklist
self.theme_settings.custom_css = str(custom_css)
self.theme_settings.doctype = doctype

Expand Down

0 comments on commit d6db78d

Please sign in to comment.