[Testbot] Plone 4.3 - Python 2.6 - Build # 1855 - Still failing! - 1 failure(s)

jenkins at plone.org jenkins at plone.org
Wed Mar 12 20:15:21 UTC 2014


-------------------------------------------------------------------------------
Plone 4.3 - Python 2.6 - Build # 1855 - Still Failing!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-4.3-python-2.6/1855/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: Products.CMFPlone
Branch: refs/heads/4.3.x
Date: 2014-03-12T20:37:49+01:00
Author: Philip Bauer (pbauer) <bauer at starzel.de>
Commit: https://github.com/plone/Products.CMFPlone/commit/003f01a1b012fadc2d7ac690ac38697fec2f03fc

Remove trailing and leading whitespaces from id and title on rename.

Files changed:
M Products/CMFPlone/skins/plone_form_scripts/validate_folder_rename.vpy
M Products/CMFPlone/skins/plone_scripts/folder_rename.cpy
M Products/CMFPlone/tests/testFolderButtons.py
M docs/CHANGES.rst

diff --git a/Products/CMFPlone/skins/plone_form_scripts/validate_folder_rename.vpy b/Products/CMFPlone/skins/plone_form_scripts/validate_folder_rename.vpy
index 81caf12..de3de45 100644
--- a/Products/CMFPlone/skins/plone_form_scripts/validate_folder_rename.vpy
+++ b/Products/CMFPlone/skins/plone_form_scripts/validate_folder_rename.vpy
@@ -11,8 +11,8 @@
 from Products.CMFPlone import PloneMessageFactory as _
 
 paths = [path for path in paths if path]
-new_ids = [id for id in new_ids if id]
-new_titles = [title for title in new_titles]
+new_ids = [id.strip() for id in new_ids if id]
+new_titles = [title.strip() for title in new_titles]
 portal = context.portal_url.getPortalObject()
 check_id = context.check_id
 
@@ -44,12 +44,6 @@ for x in range(0, len(new_ids)):
         if error:
             state.setError(id, error)
 
-for i in new_ids:
-    if i != i.strip():
-        context.plone_utils.addPortalMessage(
-            _(u'The id "%s" has leading or trailing spaces.' % i), 'error')
-        return state.set(status='failure')
-
 if state.getErrors():
     context.plone_utils.addPortalMessage(
         _(u'Please correct the indicated errors.'), 'error')
diff --git a/Products/CMFPlone/skins/plone_scripts/folder_rename.cpy b/Products/CMFPlone/skins/plone_scripts/folder_rename.cpy
index 1240e7a..6feba47 100644
--- a/Products/CMFPlone/skins/plone_scripts/folder_rename.cpy
+++ b/Products/CMFPlone/skins/plone_scripts/folder_rename.cpy
@@ -17,6 +17,9 @@ request = context.REQUEST
 message = None
 putils = context.plone_utils
 
+new_ids = [i.strip() for i in new_ids]
+new_titles = [i.strip() for i in new_titles]
+
 orig_template = request.get('orig_template', None)
 change_template = paths and orig_template is not None
 if change_template:
diff --git a/Products/CMFPlone/tests/testFolderButtons.py b/Products/CMFPlone/tests/testFolderButtons.py
index e47ec02..a3dcb88 100644
--- a/Products/CMFPlone/tests/testFolderButtons.py
+++ b/Products/CMFPlone/tests/testFolderButtons.py
@@ -58,6 +58,18 @@ def testTitleAndIdAreUpdatedOnFolderRename(self):
         self.assertTrue(getattr(self.folder.foo, 'baz', None) is not None)
         self.assertEqual(self.folder.foo.baz.Title(), title)
 
+    def testWhitespacesAreStrippedOnFolderRename(self):
+        # Make sure renaming removes leading and trailing whitespaces
+        new_title = ' Test Folder - Snooze!  '
+        new_id = ' baz '
+        transaction.savepoint(optimistic=True)  # make rename work
+        doc_path = '/'.join(self.folder.foo.doc1.getPhysicalPath())
+        self.folder.folder_rename(paths=[doc_path], new_ids=[new_id],
+                                  new_titles=[new_title])
+        self.assertEqual(getattr(self.folder.foo, 'doc1', None), None)
+        self.assertNotEqual(getattr(self.folder.foo, 'baz', None), None)
+        self.assertEqual(self.folder.foo.baz.Title(), 'Test Folder - Snooze!')
+
     def testCatalogTitleAndIdAreUpdatedOnFolderRename(self):
         # Make sure catalog updates title on rename
         title = 'Test Folder - Snooze!'
diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst
index c981ea5..7fd498a 100644
--- a/docs/CHANGES.rst
+++ b/docs/CHANGES.rst
@@ -11,7 +11,7 @@ Changelog
 - Fix for https://dev.plone.org/ticket/13603 would break with VHM.
   [spereverde, jakke, jfroche]
 
-- Don't rename content when the new id has leading or trailing spaces.
+- Strip leading & trailing spaces from id and title in rename-form.
   See https://dev.plone.org/ticket/12998, https://dev.plone.org/ticket/12989,
   https://dev.plone.org/ticket/9370, https://dev.plone.org/ticket/8338
   [pbauer]




-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 4141 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140312/50440b7e/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 158423 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140312/50440b7e/attachment-0003.obj>


More information about the Testbot mailing list