diff --git a/last_commit.txt b/last_commit.txt index cc47847e38..c45e8c07e1 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,230 +1,182 @@ -Repository: Products.PortalTransforms +Repository: plone.app.content Branch: refs/heads/master -Date: 2015-06-24T11:00:09+02:00 -Author: Godefroid Chapelle (gotcha) -Commit: https://github.com/plone/Products.PortalTransforms/commit/9aafffdec8cc031206d8785139a4927d67cce256 +Date: 2015-06-25T03:10:04+02:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.content/commit/9927a5251bcf3b7a9262ee85a097d45d32181300 -fix safe_html with entities after a <script> tag +Let @@getVocabulary return the vocabulary's value instead of the token for the id in the result set. The token is binary encoded and leads to encoding errors when selecting a value with non-ASCII data from vocabulary list in a select2 based widget. Fixes: https://github.com/plone/Products.CMFPlone/issues/650 Files changed: M CHANGES.rst -M Products/PortalTransforms/tests/test_transforms.py -M Products/PortalTransforms/transforms/safe_html.py +M plone/app/content/browser/vocabulary.py +M plone/app/content/tests/test_widgets.py diff --git a/CHANGES.rst b/CHANGES.rst -index 8450ec6..bc9c368 100644 +index 9e9d820..7fca280 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -4,6 +4,9 @@ Changelog - 2.1.7 (unreleased) +@@ -4,7 +4,12 @@ Changelog + 3.0.7 (unreleased) ------------------ -+- fix safe_html with entities after a ' -+ ) -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) -+ - def test_entities(self): - orig = "a > 0 && b < 1" - escaped = "a > 0 && b < 1" - data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) - self.assertEqual(data.getData(), escaped) + 3.0.6 (2015-06-05) +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index 9754fc3..9108a20 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -153,7 +153,7 @@ def __call__(self): + items.append(item) + else: + for item in results: +- items.append({'id': item.token, 'text': item.title}) ++ items.append({'id': item.value, 'text': item.title}) -+ def test_script_with_entities_and_unicode(self): -+ orig = ('' -+ '

(KU Loket) Officiële inschrijvingen

' -+ ) -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) -+ -+ def test_script_with_entities(self): -+ orig = ('' -+ '

(KU Loket)

' -+ ) -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) -+ -+ def test_entities_with_script(self): -+ orig = ('

(KU Loket)

' -+ '' -+ ) -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) -+ -+ def test_script_with_unicode(self): -+ orig = ('' -+ '

Officiële inschrijvingen

' -+ ) -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) + if total == 0: + total = len(items) +diff --git a/plone/app/content/tests/test_widgets.py b/plone/app/content/tests/test_widgets.py +index be32820..ba4a7b6 100644 +--- a/plone/app/content/tests/test_widgets.py ++++ b/plone/app/content/tests/test_widgets.py +@@ -15,6 +15,7 @@ + from plone.app.widgets.testing import ExampleVocabulary + from plone.app.widgets.testing import PLONEAPPWIDGETS_INTEGRATION_TESTING + from plone.app.widgets.testing import TestRequest ++from zope.component import getMultiAdapter + from zope.component import provideAdapter + from zope.component import provideUtility + from zope.component.globalregistry import base +@@ -175,6 +176,29 @@ def testVocabularyBatching(self): + self.assertEquals(len(data['results']), 10) + self.assertEquals(data['total'], amount) + ++ def testVocabularyEncoding(self): ++ """The vocabulary should not return the binary encoded token ++ ("N=C3=A5=C3=B8=C3=AF"), but instead the value as the id in the result ++ set. Fixes an encoding problem. See: ++ https://github.com/plone/Products.CMFPlone/issues/650 ++ """ ++ test_val = u'Nåøï' + -+ def test_entities_and_unicode(self): -+ orig = '

(KU Loket) Officiële inschrijvingen

' -+ data = self.pt.convertTo(target_mimetype='text/x-html-safe', orig=orig) -+ self.assertEqual(data.getData(), orig) ++ self.portal.invokeFactory('Document', id="page", title="page") ++ self.portal.page.subject = (test_val,) ++ self.portal.page.reindexObject(idxs=['Subject']) + ++ self.request.form['name'] = 'plone.app.vocabularies.Keywords' ++ results = getMultiAdapter( ++ (self.portal, self.request), ++ name='getVocabulary' ++ )() ++ results = json.loads(results) ++ result = results['results'][0] + ++ self.assertEquals(result['text'], test_val) ++ self.assertEquals(result['id'], test_val) + - class WordTransformsTest(ATSiteTestCase): - - def afterSetUp(self): -diff --git a/Products/PortalTransforms/transforms/safe_html.py b/Products/PortalTransforms/transforms/safe_html.py -index e5e243c..8fed210 100644 ---- a/Products/PortalTransforms/transforms/safe_html.py -+++ b/Products/PortalTransforms/transforms/safe_html.py -@@ -2534,9 +2534,9 @@ def unknown_starttag(self, tag, attrs): - pass - - def unknown_endtag(self, tag): -+ self.inside_script = False - if tag in self.nasty and not tag in self.valid: - self.suppress = False -- self.inside_script = False - if self.suppress: - return - if safeToInt(self.valid.get(tag)): + def testVocabularyUnauthorized(self): + setRoles(self.portal, TEST_USER_ID, []) + view = VocabularyView(self.portal, self.request) -Repository: Products.PortalTransforms +Repository: plone.app.content Branch: refs/heads/master -Date: 2015-06-24T12:01:28+02:00 -Author: Godefroid Chapelle (gotcha) -Commit: https://github.com/plone/Products.PortalTransforms/commit/f2f3721c236611c0145dc7213eb611ccca436ff4 +Date: 2015-06-25T10:57:01+02:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.content/commit/62bbf28c17ab89c55f8b26c1844404b781aef712 -tune manifest +Merge pull request #34 from plone/thet-vocabularyencoding -Files changed: -M MANIFEST.in - -diff --git a/MANIFEST.in b/MANIFEST.in -index f220fc4..6442174 100644 ---- a/MANIFEST.in -+++ b/MANIFEST.in -@@ -1,4 +1,5 @@ - include * -+exclude .installed.cfg - - recursive-include docs * - recursive-include Products * - - -Repository: Products.PortalTransforms - - -Branch: refs/heads/master -Date: 2015-06-24T12:01:42+02:00 -Author: Godefroid Chapelle (gotcha) -Commit: https://github.com/plone/Products.PortalTransforms/commit/021a27c72864dd43605f0682682646d15e8528f2 - -Preparing release 2.1.7 +Fix encoding problems with Mockup Select2 widget Files changed: M CHANGES.rst -M setup.py +M plone/app/content/browser/vocabulary.py +M plone/app/content/tests/test_widgets.py diff --git a/CHANGES.rst b/CHANGES.rst -index bc9c368..87bc302 100644 +index 9e9d820..7fca280 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -1,7 +1,7 @@ - Changelog - ========= - --2.1.7 (unreleased) -+2.1.7 (2015-06-24) +@@ -4,7 +4,12 @@ Changelog + 3.0.7 (unreleased) ------------------ - - fix safe_html with entities after a