[Zope] Delete property woes in ZClasses

Maik Roeder roeder@berg.net
Sat, 15 Jul 2000 14:07:39 +0200


Hi Paul !

Paul Abrams wrote:
> 
> I noticed that when you delete a property in a ZClass, it
> doesn't actually delete the property in **instances** of
> that ZClass! This leaves properties lying around where they
> can be inadvertently acquired, causing problems that are
> difficult to trace.
> 
> Has anyone gotten bitten by this, or know of a solution?

I solved it by adding this External Method, and calling
all instances with it:

#move_attribute?the_id=abstract
def delete_attribute(self,the_id):
   self._delOb(the_id)

BTW, I have also written an External Method that moves
the attribute to a DTML Method:

#move_attribute?the_attribute_id=abstract
def move_attribute(self,the_attribute_id):
   attribute=str(getattr(self, the_attribute_id))
   self._delOb(the_attribute_id)
   if attribute!="":
      self.manage_addDTMLMethod(the_attribute_id,file=" " + attribute)

Regards,

Maik Röder

-- 
"The computing future is based  on "cyberbodies" - self-contained, 
neatly-ordered,  beautifully-laid-out  collections of information, 
like immaculate giant gardens." The second coming - A manifesto. David
Gelernter http://www.edge.org/3rd_culture/gelernter/gelernter_p1.html