[Zope-Checkins] CVS: Packages/OFS - CopySupport.py:1.85.2.8

Andreas Jung andreas at andreas-jung.com
Fri Nov 26 09:22:17 EST 2004


Update of /cvs-repository/Packages/OFS
In directory cvs.zope.org:/tmp/cvs-serv693/lib/python/OFS

Modified Files:
      Tag: Zope-2_7-branch
	CopySupport.py 
Log Message:
      - Collector #1593: fixed dumb _get_id() implementation in
        OFS.CopySupport that produced copy_of_copy_of....files


=== Packages/OFS/CopySupport.py 1.85.2.7 => 1.85.2.8 ===
--- Packages/OFS/CopySupport.py:1.85.2.7	Sat Aug  7 13:15:48 2004
+++ Packages/OFS/CopySupport.py	Fri Nov 26 09:22:16 2004
@@ -13,7 +13,7 @@
 __doc__="""Copy interface"""
 __version__='$Revision$'[11:-2]
 
-import sys,  Globals, Moniker, tempfile, ExtensionClass
+import re, sys,  Globals, Moniker, tempfile, ExtensionClass
 from marshal import loads, dumps
 from urllib import quote, unquote
 from zlib import compress, decompress
@@ -112,14 +112,19 @@
             return self.manage_main(self, REQUEST)
         return cp
 
+    copy_re=re.compile('^copy[0-9]*_of_')
+
     def _get_id(self, id):
         # Allow containers to override the generation of
         # object copy id by attempting to call its _get_id
         # method, if it exists.
-        n=0
-        if (len(id) > 8) and (id[8:]=='copy_of_'):
+        copy_match=self.copy_re.match(id)
+        if (copy_match) and (copy_match.end() < len(id)):
             n=1
-        orig_id=id
+            orig_id=self.copy_re.sub('', id)
+        else:
+            n=0
+            orig_id=id
         while 1:
             if self._getOb(id, None) is None:
                 return id



More information about the Zope-Checkins mailing list