[CMF-checkins] CVS: CMF/CMFCore - FSObject.py:1.14.12.3

Andy McKay andy at agmweb.ca
Thu Jun 3 03:42:27 EDT 2004


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv13315

Modified Files:
      Tag: CMF-1_4-branch
	FSObject.py 
Log Message:
Stupid fix from CMF Head that I thought was in CMF 1.4 branch for not showing an error when someone customises something twice, rather shows them a nice message and takes them to the already customised object.


=== CMF/CMFCore/FSObject.py 1.14.12.2 => 1.14.12.3 ===
--- CMF/CMFCore/FSObject.py:1.14.12.2	Fri Apr 23 17:11:33 2004
+++ CMF/CMFCore/FSObject.py	Thu Jun  3 03:42:26 2004
@@ -22,6 +22,7 @@
 from AccessControl import ClassSecurityInfo
 from OFS.SimpleItem import Item
 from DateTime import DateTime
+from Products.PythonScripts.standard import html_quote
 
 from utils import expandpath, getToolByName
 from CMFCorePermissions import View
@@ -81,11 +82,22 @@
         fpath = tuple(split(folder_path, '/'))
         portal_skins = getToolByName(self,'portal_skins') 
         folder = portal_skins.restrictedTraverse(fpath)
-        folder._verifyObjectPaste(obj, validate_src=0)
-        folder._setObject(id, obj)
 
-        if RESPONSE is not None:
-            RESPONSE.redirect('%s/%s/manage_main' % (
+        if id in folder.objectIds():
+            # we cant catch the badrequest so
+            # we'll that to check before hand, which makes
+            # sense anyway...
+            obj = folder._getOb(id)
+            if RESPONSE is not None:
+                RESPONSE.redirect('%s/manage_main?manage_tabs_message=%s' % (
+                    obj.absolute_url(), html_quote("An object with this id already exists")
+                    ))
+        else:
+            folder._verifyObjectPaste(obj, validate_src=0)
+            folder._setObject(id, obj)
+
+            if RESPONSE is not None:
+                RESPONSE.redirect('%s/%s/manage_main' % (
                 folder.absolute_url(), id))
 
     def _createZODBClone(self):




More information about the CMF-checkins mailing list