[Testbot] Plone 5.0 - Python 2.7 - Build # 4001 - Still failing! - 0 failure(s)

jenkins at plone.org jenkins at plone.org
Thu Jan 22 18:47:36 UTC 2015


-------------------------------------------------------------------------------
Plone 5.0 - Python 2.7 - Build # 4001 - Still Failing!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-5.0-python-2.7/4001/


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

Repository: plone.app.content
Branch: refs/heads/master
Date: 2015-01-22T19:06:03+01:00
Author: Philip Bauer (pbauer) <bauer at starzel.de>
Commit: https://github.com/plone/plone.app.content/commit/4986347956ac0886e48c9755757ca9f2188a8855

Use INameChooser for new id when renaming objects

Files changed:
M CHANGES.rst
M plone/app/content/browser/actions.py
M plone/app/content/tests/test_actions.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 941d44c..c21c4f2 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,9 +4,14 @@ Changelog
 3.0.2 (unreleased)
 ------------------
 
+- Use INameChooser for new id when renaming objects.
+  Fix https://github.com/plone/plone.app.dexterity/issues/73
+  [pbauer]
+
 - Allow folderish types as default_page as long as users cannot add content
   to them.
   [pbauer]
+
 - fix removing tags with non-ascii characters in folder_contents
   [petschki]
 
diff --git a/plone/app/content/browser/actions.py b/plone/app/content/browser/actions.py
index 7fc996f..e2ae3c2 100644
--- a/plone/app/content/browser/actions.py
+++ b/plone/app/content/browser/actions.py
@@ -17,6 +17,7 @@
 from zope import schema
 from zope.component import getMultiAdapter
 from zope.component import queryMultiAdapter
+from zope.container.interfaces import INameChooser
 from zope.event import notify
 from zope.interface import Interface
 from zope.lifecycleevent import ObjectModifiedEvent
@@ -117,6 +118,7 @@ def handle_rename(self, action):
 
         oldid = self.context.getId()
         newid = data['new_id']
+        newid = INameChooser(parent).chooseName(newid, self.context)
 
         # Requires cmf.ModifyPortalContent permission
         self.context.title = data['new_title']
diff --git a/plone/app/content/tests/test_actions.py b/plone/app/content/tests/test_actions.py
index 135bc86..e16d0c6 100644
--- a/plone/app/content/tests/test_actions.py
+++ b/plone/app/content/tests/test_actions.py
@@ -118,6 +118,23 @@ def test_rename_form(self):
         self.portal.manage_delObjects(ids='f2')
         transaction.commit()
 
+    def test_create_safe_id_on_renaming(self):
+        logout()
+        folder = self.portal['f1']
+
+        # We need zope2.CopyOrMove permission to rename content
+        self.browser.open(folder.absolute_url() + '/folder_rename')
+        self.browser.getControl(name='form.widgets.new_id').value = ' ? f4 4 '
+        self.browser.getControl(name='form.widgets.new_title').value = ' F2 '
+        self.browser.getControl(name='form.buttons.Rename').click()
+        self.assertEqual(folder.getId(), 'f4-4')
+        self.assertEqual(folder.Title(), 'F2')
+        self.assertEqual(self.browser.url, folder.absolute_url())
+
+        login(self.portal, TEST_USER_NAME)
+        self.portal.manage_delObjects(ids='f4-4')
+        transaction.commit()
+
     def test_rename_form_cancel(self):
         folder = self.portal['f1']
 




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


More information about the Testbot mailing list