Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/1.3.x Date: 2015-11-20T12:23:30+01:00 Author: Godefroid Chapelle (gotcha) <gotcha@bubblenet.be> Commit: plone/Products.TinyMCE@a0f5469 fix `path` expression in `wysiwyg_support` `plone.app.z3cform` support for `collective.ckeditor` where `ckeditor_wysiwyg_support` is a view rather than a skin Files changed: M HISTORY.rst M Products/TinyMCE/skins/tinymce/wysiwyg_support.pt Repository: Products.TinyMCE Branch: refs/heads/1.3.x Date: 2015-11-20T11:31:25Z Author: Godefroid Chapelle (gotcha) <gotcha@bubblenet.be> Commit: plone/Products.TinyMCE@65cfd7f Merge pull request #124 from plone/fix_traversal fix `path` expression in `wysiwyg_support` `plone.app.z3cform` support for `collective.ckeditor` where `ckeditor_wysiwyg_support` is a view rather than a skin Files changed: M HISTORY.rst M Products/TinyMCE/skins/tinymce/wysiwyg_support.pt
- Loading branch information
Showing
1 changed file
with
79 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,190 +1,96 @@ | ||
Repository: archetypes.querywidget | ||
Repository: Products.TinyMCE | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2015-05-04T11:08:08-03:00 | ||
Author: Rodrigo Ferreira de Souza (rodfersou) <rodfersou@gmail.com> | ||
Commit: https://github.com/plone/archetypes.querywidget/commit/604d35613199442bee51d3ef7120f76bc18f1ba7 | ||
Branch: refs/heads/1.3.x | ||
Date: 2015-11-20T12:23:30+01:00 | ||
Author: Godefroid Chapelle (gotcha) <gotcha@bubblenet.be> | ||
Commit: https://github.com/plone/Products.TinyMCE/commit/a0f5469a615b3488b6369a44492081adbed5eb6a | ||
|
||
Added 'safe_unicode' call for raw query values | ||
fix `path` expression in `wysiwyg_support` | ||
|
||
`plone.app.z3cform` support for `collective.ckeditor` where | ||
`ckeditor_wysiwyg_support` is a view rather than a skin | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M archetypes/querywidget/field.py | ||
M archetypes/querywidget/tests/integration.rst | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index d30a250..dab34c9 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -4,7 +4,8 @@ Changelog | ||
1.1.3 (unreleased) | ||
------------------ | ||
|
||
-- Nothing changed yet. | ||
+- Added 'safe_unicode' call for raw query values. | ||
+ [rodfersou] | ||
|
||
|
||
1.1.2 (2014-11-05) | ||
diff --git a/archetypes/querywidget/field.py b/archetypes/querywidget/field.py | ||
index 876564a..6fda4ad 100644 | ||
--- a/archetypes/querywidget/field.py | ||
+++ b/archetypes/querywidget/field.py | ||
@@ -1,8 +1,9 @@ | ||
-from copy import deepcopy | ||
from AccessControl import ClassSecurityInfo | ||
from archetypes.querywidget.interfaces import IQueryField | ||
+from copy import deepcopy | ||
from Products.Archetypes.Field import ObjectField | ||
from Products.Archetypes.Field import registerField | ||
+from Products.CMFPlone.utils import safe_unicode | ||
from zope.component import getMultiAdapter | ||
from zope.interface import implements | ||
from zope.site.hooks import getSite | ||
@@ -37,7 +38,22 @@ def get(self, instance, **kwargs): | ||
custom_query=kwargs.get('custom_query', {})) | ||
|
||
def getRaw(self, instance, **kwargs): | ||
- return deepcopy(ObjectField.get(self, instance, **kwargs) or []) | ||
+ value = deepcopy(ObjectField.get(self, instance, **kwargs) or []) | ||
+ safe_value = [] | ||
+ for query in value: | ||
+ safe_query = {} | ||
+ for k, v in query.items(): | ||
+ if type(v) is list: | ||
+ safe_v = [] | ||
+ for i in v: | ||
+ safe_v.append(safe_unicode(i)) | ||
+ safe_query[k] = safe_v | ||
+ elif type(v) is str: | ||
+ safe_query[k] = safe_unicode(v) | ||
+ else: | ||
+ safe_query[k] = v | ||
+ safe_value.append(safe_query) | ||
+ return safe_value | ||
|
||
|
||
registerField(QueryField, title='QueryField', | ||
diff --git a/archetypes/querywidget/tests/integration.rst b/archetypes/querywidget/tests/integration.rst | ||
index b22d4a1..2a60bc1 100644 | ||
--- a/archetypes/querywidget/tests/integration.rst | ||
+++ b/archetypes/querywidget/tests/integration.rst | ||
@@ -38,7 +38,7 @@ Check for bug `#13144 <https://dev.plone.org/ticket/13144>`_:: | ||
>>> field.set(portal.collection, [{'i': 'start', 'o': 'some.namespace.op.foo'}]) | ||
>>> raw1 = field.get(portal.collection, raw=True) | ||
>>> raw1 | ||
- [{'i': 'start', 'o': 'some.namespace.op.foo'}] | ||
+ [{'i': u'start', 'o': u'some.namespace.op.foo'}] | ||
|
||
>>> length1 = len(raw1) | ||
>>> raw1.append({'i': 'end', 'o': 'some.namespace.op.bar'}) | ||
@@ -48,3 +48,10 @@ Now the amount of entries in raw2 has to be the same as in raw1:: | ||
|
||
>>> length1 == len(raw2) | ||
True | ||
+ | ||
+Check for bug with unicode strings as a value:: | ||
M HISTORY.rst | ||
M Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
|
||
diff --git a/HISTORY.rst b/HISTORY.rst | ||
index 02e24a0..9f8f9f9 100644 | ||
--- a/HISTORY.rst | ||
+++ b/HISTORY.rst | ||
@@ -14,6 +14,10 @@ Fixes: | ||
- Let upload adapter check permissions | ||
[tschorr] | ||
|
||
+- fix `path` expression in `wysiwyg_support`; | ||
+ `plone.app.z3cform` support for `collective.ckeditor` where | ||
+ `ckeditor_wysiwyg_support` is a view rather than a skin | ||
+ | ||
+ >>> field = portal.collection.getField('query') | ||
+ >>> field.set(portal.collection, [{'i': 'start', 'o': 'some.namespace.op.foo', 'v': 'áéíóú'}]) | ||
+ >>> field.get(portal.collection, raw=True) | ||
+ [{'i': u'start', 'o': u'some.namespace.op.foo', 'v': u'\xe1\xe9\xed\xf3\xfa'}] | ||
- *add item here* | ||
|
||
|
||
diff --git a/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt b/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
index aa4fa20..d7508a0 100644 | ||
--- a/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
+++ b/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
@@ -7,7 +7,7 @@ | ||
default_editor python: context.portal_properties.site_properties.getProperty('default_editor'); | ||
default_editor python: (default_editor or 'None').lower(); | ||
editor python: test(member_editor=='', default_editor, member_editor); | ||
- support python: editor.lower() == 'none' and path('nocall:here/portal_skins/plone_wysiwyg/wysiwyg_support') or path('nocall:here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/portal_skins/plone_wysiwyg/wysiwyg_support' % (editor, editor, default_editor, default_editor));"> | ||
+ support python: editor.lower() == 'none' and path('nocall:here/portal_skins/plone_wysiwyg/wysiwyg_support') or path('nocall:here/@@%s_wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/@@%s_wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/portal_skins/plone_wysiwyg/wysiwyg_support' % (editor, editor, editor, default_editor, default_editor, default_editor));"> | ||
<metal:block metal:use-macro="support/macros/wysiwygEditorBox"> | ||
</metal:block> | ||
</tal:block> | ||
|
||
|
||
Repository: archetypes.querywidget | ||
Repository: Products.TinyMCE | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2015-11-09T20:28:02-02:00 | ||
Author: Héctor Velarde (hvelarde) <hvelarde@yahoo.com> | ||
Commit: https://github.com/plone/archetypes.querywidget/commit/80fd0c9ff0b3800b2936993dd96cff0831bbf156 | ||
Branch: refs/heads/1.3.x | ||
Date: 2015-11-20T11:31:25Z | ||
Author: Godefroid Chapelle (gotcha) <gotcha@bubblenet.be> | ||
Commit: https://github.com/plone/Products.TinyMCE/commit/65cfd7f79d0d75c42cc203469e4a26da57ec7a60 | ||
|
||
Merge pull request #12 from plone/use_safe_unicode | ||
Merge pull request #124 from plone/fix_traversal | ||
|
||
Added 'safe_unicode' call for raw query values | ||
fix `path` expression in `wysiwyg_support` | ||
|
||
`plone.app.z3cform` support for `collective.ckeditor` where | ||
`ckeditor_wysiwyg_support` is a view rather than a skin | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M archetypes/querywidget/field.py | ||
M archetypes/querywidget/tests/integration.rst | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index d30a250..dab34c9 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -4,7 +4,8 @@ Changelog | ||
1.1.3 (unreleased) | ||
------------------ | ||
|
||
-- Nothing changed yet. | ||
+- Added 'safe_unicode' call for raw query values. | ||
+ [rodfersou] | ||
|
||
|
||
1.1.2 (2014-11-05) | ||
diff --git a/archetypes/querywidget/field.py b/archetypes/querywidget/field.py | ||
index 876564a..6fda4ad 100644 | ||
--- a/archetypes/querywidget/field.py | ||
+++ b/archetypes/querywidget/field.py | ||
@@ -1,8 +1,9 @@ | ||
-from copy import deepcopy | ||
from AccessControl import ClassSecurityInfo | ||
from archetypes.querywidget.interfaces import IQueryField | ||
+from copy import deepcopy | ||
from Products.Archetypes.Field import ObjectField | ||
from Products.Archetypes.Field import registerField | ||
+from Products.CMFPlone.utils import safe_unicode | ||
from zope.component import getMultiAdapter | ||
from zope.interface import implements | ||
from zope.site.hooks import getSite | ||
@@ -37,7 +38,22 @@ def get(self, instance, **kwargs): | ||
custom_query=kwargs.get('custom_query', {})) | ||
|
||
def getRaw(self, instance, **kwargs): | ||
- return deepcopy(ObjectField.get(self, instance, **kwargs) or []) | ||
+ value = deepcopy(ObjectField.get(self, instance, **kwargs) or []) | ||
+ safe_value = [] | ||
+ for query in value: | ||
+ safe_query = {} | ||
+ for k, v in query.items(): | ||
+ if type(v) is list: | ||
+ safe_v = [] | ||
+ for i in v: | ||
+ safe_v.append(safe_unicode(i)) | ||
+ safe_query[k] = safe_v | ||
+ elif type(v) is str: | ||
+ safe_query[k] = safe_unicode(v) | ||
+ else: | ||
+ safe_query[k] = v | ||
+ safe_value.append(safe_query) | ||
+ return safe_value | ||
|
||
|
||
registerField(QueryField, title='QueryField', | ||
diff --git a/archetypes/querywidget/tests/integration.rst b/archetypes/querywidget/tests/integration.rst | ||
index b22d4a1..2a60bc1 100644 | ||
--- a/archetypes/querywidget/tests/integration.rst | ||
+++ b/archetypes/querywidget/tests/integration.rst | ||
@@ -38,7 +38,7 @@ Check for bug `#13144 <https://dev.plone.org/ticket/13144>`_:: | ||
>>> field.set(portal.collection, [{'i': 'start', 'o': 'some.namespace.op.foo'}]) | ||
>>> raw1 = field.get(portal.collection, raw=True) | ||
>>> raw1 | ||
- [{'i': 'start', 'o': 'some.namespace.op.foo'}] | ||
+ [{'i': u'start', 'o': u'some.namespace.op.foo'}] | ||
|
||
>>> length1 = len(raw1) | ||
>>> raw1.append({'i': 'end', 'o': 'some.namespace.op.bar'}) | ||
@@ -48,3 +48,10 @@ Now the amount of entries in raw2 has to be the same as in raw1:: | ||
|
||
>>> length1 == len(raw2) | ||
True | ||
+ | ||
+Check for bug with unicode strings as a value:: | ||
M HISTORY.rst | ||
M Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
|
||
diff --git a/HISTORY.rst b/HISTORY.rst | ||
index 02e24a0..9f8f9f9 100644 | ||
--- a/HISTORY.rst | ||
+++ b/HISTORY.rst | ||
@@ -14,6 +14,10 @@ Fixes: | ||
- Let upload adapter check permissions | ||
[tschorr] | ||
|
||
+- fix `path` expression in `wysiwyg_support`; | ||
+ `plone.app.z3cform` support for `collective.ckeditor` where | ||
+ `ckeditor_wysiwyg_support` is a view rather than a skin | ||
+ | ||
+ >>> field = portal.collection.getField('query') | ||
+ >>> field.set(portal.collection, [{'i': 'start', 'o': 'some.namespace.op.foo', 'v': 'áéíóú'}]) | ||
+ >>> field.get(portal.collection, raw=True) | ||
+ [{'i': u'start', 'o': u'some.namespace.op.foo', 'v': u'\xe1\xe9\xed\xf3\xfa'}] | ||
- *add item here* | ||
|
||
|
||
diff --git a/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt b/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
index aa4fa20..d7508a0 100644 | ||
--- a/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
+++ b/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt | ||
@@ -7,7 +7,7 @@ | ||
default_editor python: context.portal_properties.site_properties.getProperty('default_editor'); | ||
default_editor python: (default_editor or 'None').lower(); | ||
editor python: test(member_editor=='', default_editor, member_editor); | ||
- support python: editor.lower() == 'none' and path('nocall:here/portal_skins/plone_wysiwyg/wysiwyg_support') or path('nocall:here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/portal_skins/plone_wysiwyg/wysiwyg_support' % (editor, editor, default_editor, default_editor));"> | ||
+ support python: editor.lower() == 'none' and path('nocall:here/portal_skins/plone_wysiwyg/wysiwyg_support') or path('nocall:here/@@%s_wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/@@%s_wysiwyg_support|here/%s_wysiwyg_support|here/%s/wysiwyg_support|here/portal_skins/plone_wysiwyg/wysiwyg_support' % (editor, editor, editor, default_editor, default_editor, default_editor));"> | ||
<metal:block metal:use-macro="support/macros/wysiwygEditorBox"> | ||
</metal:block> | ||
</tal:block> | ||
|
||
|