The only way I've found to do this thus far is to add the following method to
classes which I want to have deepcopyable instances:

   def __deepcopy__(self,memo):
      self=getattr(self,'aq_base',self)
      new=cPickle.loads(cPickle.dumps(self))
      new.__dict__=copy.deepcopy(self.__dict__,memo)
      return new

using cPickle like that seems really slow and ugly, and requiring that every
class that might be deepcopied at the very least inherits from a mixin is
less than optimal.

Does anyone have a better solution?

Thanks,

Toby.

-- 
  [ Toby Sargeant : Inpharmatica : Developer : [EMAIL PROTECTED] ]
      [ http://www.inpharmatica.co.uk : 020 7631 4644 fax 020 7631 4844 ]

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to