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

Andy McKay andy at agmweb.ca
Fri Sep 12 20:46:41 EDT 2003


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

Modified Files:
	FSObject.py 
Log Message:
A fix for #188, this was annoying me too


=== CMF/CMFCore/FSObject.py 1.14 => 1.15 ===
--- CMF/CMFCore/FSObject.py:1.14	Thu Jan 30 15:26:50 2003
+++ CMF/CMFCore/FSObject.py	Fri Sep 12 20:46:40 2003
@@ -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,8 +82,21 @@
         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 id in folder.objectIds():
+            # we cant catch the badrequest so
+            # we'll that to check before hand
+            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))
 
         if RESPONSE is not None:
             RESPONSE.redirect('%s/%s/manage_main' % (




More information about the CMF-checkins mailing list