Hi Paul I'm writing because I had the same trouble that you describe on this page: http://www.zope.org/Members/paulabrams/howto_deleteundeadzclassprops For the sake of the list, I quote: 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 zombie properties lying around where they can be inadvertently acquired, causing problems that are difficult to trace. Since these properties override properties set in the REQUEST, if the do get acquired they are difficult to override. I logged this bug in the collector, which affected my Zope 2.1.6 install. Maik Röder was kind enough to email me the solution below. He solved the problem 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) On Zope 2.3.3, this gets me:: Error Type: AttributeError Error Value: _delOb I tried 'manage_delObjects(ids)' and 'manage_delProperties(ids)', without success. I'd like to ask whether you've learnt anything new about this problem since 2000/12/05? Also, could you tell me what the Issue Id of this issue is in the collector? I tried searching at http://classic.zope.org:8080/Collector/ but without success. Regards, Jean Jordaan
Hi Jean, The defect I logged is #1424, which is still pending. http://classic.zope.org:8080/Collector/1434/view Description: When you delete a property from a ZClass property sheet, the property is not actually deleted from **instances** of that ZClass. This leaves properties lying around where they can be inadvertently acquired, causing problems that are difficult to trace. Oddly enough, this related defect was closed "as designed". http://classic.zope.org:8080/Collector/1652/view Description: Deleteing a property from the PropertySheet does not delete the attribute of any instantiated object of this ZClass. So, the 'property' can still be accessed(i.e. hasattr(),getattr()), just not changed and can no longer be deleted because it does not live in the ZClass property Sheet anymore. If a new instance of the ZClass is created, this 'property' is NOT available as an attribute. Response: As you described, deleting a property from a property sheet does not remove it from instances. This is correct behavior. It would not be practical to seek out and modify all instances with the property. I still think that the issue is a bug that Zope should fix, because it can play havoc with acquisition and is quite difficult to detect. I remember spending quite a few puzzled hours before I realized what was happening...and it could easily happen again. The developer should be allowed to decide whether or not the full sweep is practical--when a property is deleted Zope should ask if the ZODB should be swept to fix zombie instances. Cheers, -Paul -----Original Message----- From: Jean Jordaan [mailto:jean@upfrontsystems.co.za] Sent: Wednesday, September 05, 2001 6:30 AM To: paul@hiringtools.com Cc: zope@zope.org Subject: Undead ZClass properties Hi Paul I'm writing because I had the same trouble that you describe on this page: http://www.zope.org/Members/paulabrams/howto_deleteundeadzclassprops For the sake of the list, I quote: 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 zombie properties lying around where they can be inadvertently acquired, causing problems that are difficult to trace. Since these properties override properties set in the REQUEST, if the do get acquired they are difficult to override. I logged this bug in the collector, which affected my Zope 2.1.6 install. Maik Röder was kind enough to email me the solution below. He solved the problem 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) On Zope 2.3.3, this gets me:: Error Type: AttributeError Error Value: _delOb I tried 'manage_delObjects(ids)' and 'manage_delProperties(ids)', without success. I'd like to ask whether you've learnt anything new about this problem since 2000/12/05? Also, could you tell me what the Issue Id of this issue is in the collector? I tried searching at http://classic.zope.org:8080/Collector/ but without success. Regards, Jean Jordaan
Hi Paul Thanks for the answer. The Collector isn't letting me in right now (Zero Sized Reply) but I'll keep trying.
As you described, deleting a property from a property sheet does not remove it from instances. This is correct behavior. It would not be practical to seek out and modify all instances with the property.
I still think that the issue is a bug that Zope should fix, because it can play havoc with acquisition and is quite difficult to detect.
I fully agree. At the very least, it should be possible to search the ZODB for zombie properties (ZClass instances properties that do not exist on that ZClass's propertysheets). The workaround currently seems to me to be something like *never* deleting a ZClass property, and simply setting its default value to something like "DON'T USE ME!". It doesn't make the problem go away, but at least it keeps it in sight! :/ Regards, jean
participants (2)
-
Jean Jordaan -
Paul Abrams