[Zope] Custom id genaration on copy/paste of ZClass
Ralph vd Houdt
ralph@ezcompany.nl
Wed, 18 Sep 2002 12:19:28 +0200
Hi All,
I created my own ZClass which has a generated id, when I copy & paste the
ZClass in the same folder I want a new id generated for the copy and not
the automatic 'copy_of' id. I looked at CopySupport.py and it states:
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_'):
n=1
orig_id=id
while 1:
if self._getOb(id, None) is None:
return id
id='copy%s_of_%s' % (n and n+1 or '', orig_id)
n=n+1
Is it possible te override this method in a ZClass to create my own id's
Greetings Ralph