Skip to content

Commit

Permalink
[fc] Repository: Products.ResourceRegistries
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2014-09-30T12:28:51+02:00
Author: Harald Friessnegger (frisi) <harald@webmeisterei.com>
Commit: plone/Products.ResourceRegistries@03f732d

handle theme names containing a `.` correctly.

zpublisher puts them into another namespace so manage_saveBundlesFortheme won't find theme.

eg ``REQUEST.form`` is::

  {'mappings.my': {'theme': ['jquery', 'mytheme']}, 'mappings': {'Plone Classic Theme': ['jquery', 'default'], 'Plone Default': ['jquery', 'default'], 'Sunburst Theme': ['jquery', 'default']}}

instead of::

  {'mappings': {'my.theme': ['jquery', 'mytheme'], 'Plone Classic Theme': ['jquery', 'default'], 'Plone Default': ['jquery', 'default'], 'Sunburst Theme': ['jquery', 'default']}}

we work around this by replacing dots with `___` in the form handling.

Files changed:
M CHANGES.rst
M Products/ResourceRegistries/tools/BaseRegistry.py
M Products/ResourceRegistries/www/bundles.zpt
Repository: Products.ResourceRegistries
Branch: refs/heads/master
Date: 2015-09-22T01:13:48+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/Products.ResourceRegistries@67dd9be

Merge pull request #18 from plone/zmi-fix

handle theme names containing a `.` correctly.

Files changed:
M CHANGES.rst
M Products/ResourceRegistries/tools/BaseRegistry.py
M Products/ResourceRegistries/www/bundles.zpt
  • Loading branch information
jensens committed Sep 21, 2015
1 parent 5fbf405 commit 382f8b0
Showing 1 changed file with 158 additions and 56 deletions.
214 changes: 158 additions & 56 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,96 +1,198 @@
Repository: plone.app.event
Repository: Products.ResourceRegistries


Branch: refs/heads/master
Date: 2015-09-21T18:36:09-04:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.app.event/commit/a0fc47d2874756cf953751c3240bc9cc79fbffcf
Date: 2014-09-30T12:28:51+02:00
Author: Harald Friessnegger (frisi) <harald@webmeisterei.com>
Commit: https://github.com/plone/Products.ResourceRegistries/commit/03f732d3e4a6bc090bad4e69224f2bf1f53bd9c0

Preparing release 2.0.2
handle theme names containing a `.` correctly.

zpublisher puts them into another namespace so manage_saveBundlesFortheme won't find theme.

eg ``REQUEST.form`` is::

{'mappings.my': {'theme': ['jquery', 'mytheme']}, 'mappings': {'Plone Classic Theme': ['jquery', 'default'], 'Plone Default': ['jquery', 'default'], 'Sunburst Theme': ['jquery', 'default']}}

instead of::

{'mappings': {'my.theme': ['jquery', 'mytheme'], 'Plone Classic Theme': ['jquery', 'default'], 'Plone Default': ['jquery', 'default'], 'Sunburst Theme': ['jquery', 'default']}}

we work around this by replacing dots with `___` in the form handling.

Files changed:
M CHANGES.rst
M setup.py
M Products/ResourceRegistries/tools/BaseRegistry.py
M Products/ResourceRegistries/www/bundles.zpt

diff --git a/CHANGES.rst b/CHANGES.rst
index b6a3a25..2a88a83 100644
index f7cebbf..3729542 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,9 +1,15 @@
Changelog
=========
@@ -9,6 +9,9 @@ Changelog
http://stackoverflow.com/questions/9664282
[thet]

-2.0.2 (unreleased)
+2.0.2 (2015-09-21)
------------------

+- Update French translations
+ [enclope]
+
+- Resolve deprecation warning for getDefaultPage.
+ [jensens]
+- bugfix: Handle theme names containing a `.` properly in ``manage_bundlesForm``
+ [fRiSi]
+
- Fix word break on event linsting template
[sneridagh]
- bugfix: do not convert URIs such as
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lv) to absolute urls
see https://github.com/plone/Products.ResourceRegistries/pull/16
diff --git a/Products/ResourceRegistries/tools/BaseRegistry.py b/Products/ResourceRegistries/tools/BaseRegistry.py
index aed0700..94174b3 100644
--- a/Products/ResourceRegistries/tools/BaseRegistry.py
+++ b/Products/ResourceRegistries/tools/BaseRegistry.py
@@ -95,7 +95,7 @@ class Resource(Persistent):

diff --git a/setup.py b/setup.py
index 9d9e2da..aa8f0d5 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
import os
def __init__(self, id, **kwargs):
self._data = PersistentMapping()
- extres = id.startswith('http://') or id.startswith('https://') or id.startswith('//')
+ extres = id.startswith('http://') or id.startswith('https://') or id.startswith('//')
if not extres and (id.startswith('/') or id.endswith('/') or ('//' in id)):
raise ValueError("Invalid Resource ID: %s" % id)
self._data['id'] = id
@@ -664,7 +664,7 @@ def getResourceContent(self, item, context, original=False, theme=None):
default_charset = 'utf-8'

for id in ids:
- # skip external resources that look like //netdna.bootstrapcdn.com/etc...
+ # skip external resources that look like //netdna.bootstrapcdn.com/etc...
if id[0:2] == '//':
continue
try:
@@ -905,7 +905,7 @@ def manage_saveBundlesForThemes(self, mappings={}, REQUEST=None):

-version = '2.0.2.dev0'
+version = '2.0.2'
m = {}
for k,v in mappings.items():
- m[str(k)] = [str(x) for x in v if x]
+ m[str(k).replace('___', '.')] = [str(x) for x in v if x]
settings.resourceBundlesForThemes = m

self.cookResources()
diff --git a/Products/ResourceRegistries/www/bundles.zpt b/Products/ResourceRegistries/www/bundles.zpt
index 732bd5f..f6406bd 100644
--- a/Products/ResourceRegistries/www/bundles.zpt
+++ b/Products/ResourceRegistries/www/bundles.zpt
@@ -71,20 +71,21 @@ legend {

setup(
<fieldset>
<legend>Bundles for themes</legend>
-
+
<p>Choose which bundles are associated with which themes</p>

<div tal:repeat="theme context/aq_parent/portal_skins/getSkinSelections">
<label tal:content="theme" />
-
+
<textarea
rows="5"
style="margin-bottom: 10px"
- tal:define="m python:mappings.get(theme, [])"
+ tal:define="m python:mappings.get(theme, []);
+ themename python: theme.replace('.', '___')"
tal:attributes="name string:mappings.${theme}:record:lines"
tal:content="python:'\n'.join(m)"
/>
-
+
</div>

<p style="clear:both">&nbsp;</p>


Repository: plone.app.event
Repository: Products.ResourceRegistries


Branch: refs/heads/master
Date: 2015-09-21T18:37:27-04:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.app.event/commit/7d73d28b35df900483b9e59d87b8fc5218914413
Date: 2015-09-22T01:13:48+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/Products.ResourceRegistries/commit/67dd9be68ee8f72b13caecfd998952c42014a393

Merge pull request #18 from plone/zmi-fix

Back to development: 2.0.3
handle theme names containing a `.` correctly.

Files changed:
M CHANGES.rst
M setup.py
M Products/ResourceRegistries/tools/BaseRegistry.py
M Products/ResourceRegistries/www/bundles.zpt

diff --git a/CHANGES.rst b/CHANGES.rst
index 2a88a83..68a4330 100644
index 88aa11e..211e1a5 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,12 @@
Changelog
=========
@@ -24,6 +24,9 @@ Changelog
http://stackoverflow.com/questions/9664282
[thet]

+2.0.3 (unreleased)
+------------------
+
+- Nothing changed yet.
+
+- bugfix: Handle theme names containing a `.` properly in ``manage_bundlesForm``
+ [fRiSi]
+
2.0.2 (2015-09-21)
------------------
- bugfix: do not convert URIs such as
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lv) to absolute urls
see https://github.com/plone/Products.ResourceRegistries/pull/16
diff --git a/Products/ResourceRegistries/tools/BaseRegistry.py b/Products/ResourceRegistries/tools/BaseRegistry.py
index aed0700..94174b3 100644
--- a/Products/ResourceRegistries/tools/BaseRegistry.py
+++ b/Products/ResourceRegistries/tools/BaseRegistry.py
@@ -95,7 +95,7 @@ class Resource(Persistent):

diff --git a/setup.py b/setup.py
index aa8f0d5..5ada1b8 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
import os
def __init__(self, id, **kwargs):
self._data = PersistentMapping()
- extres = id.startswith('http://') or id.startswith('https://') or id.startswith('//')
+ extres = id.startswith('http://') or id.startswith('https://') or id.startswith('//')
if not extres and (id.startswith('/') or id.endswith('/') or ('//' in id)):
raise ValueError("Invalid Resource ID: %s" % id)
self._data['id'] = id
@@ -664,7 +664,7 @@ def getResourceContent(self, item, context, original=False, theme=None):
default_charset = 'utf-8'

for id in ids:
- # skip external resources that look like //netdna.bootstrapcdn.com/etc...
+ # skip external resources that look like //netdna.bootstrapcdn.com/etc...
if id[0:2] == '//':
continue
try:
@@ -905,7 +905,7 @@ def manage_saveBundlesForThemes(self, mappings={}, REQUEST=None):

-version = '2.0.2'
+version = '2.0.3.dev0'
m = {}
for k,v in mappings.items():
- m[str(k)] = [str(x) for x in v if x]
+ m[str(k).replace('___', '.')] = [str(x) for x in v if x]
settings.resourceBundlesForThemes = m

self.cookResources()
diff --git a/Products/ResourceRegistries/www/bundles.zpt b/Products/ResourceRegistries/www/bundles.zpt
index 732bd5f..f6406bd 100644
--- a/Products/ResourceRegistries/www/bundles.zpt
+++ b/Products/ResourceRegistries/www/bundles.zpt
@@ -71,20 +71,21 @@ legend {

<fieldset>
<legend>Bundles for themes</legend>
-
+
<p>Choose which bundles are associated with which themes</p>

<div tal:repeat="theme context/aq_parent/portal_skins/getSkinSelections">
<label tal:content="theme" />
-
+
<textarea
rows="5"
style="margin-bottom: 10px"
- tal:define="m python:mappings.get(theme, [])"
+ tal:define="m python:mappings.get(theme, []);
+ themename python: theme.replace('.', '___')"
tal:attributes="name string:mappings.${theme}:record:lines"
tal:content="python:'\n'.join(m)"
/>
-
+
</div>

setup(
<p style="clear:both">&nbsp;</p>


0 comments on commit 382f8b0

Please sign in to comment.