When '_properties' gets stuck as a persistent attribute

01 October 2008   1 comment   Zope

Mind That Age!

This blog post is 10 years old! Most likely, its content is outdated. Especially if it's technical.

Powered by Fusion×

Doing some on-site consulting on an old Zope CMS that has been developed by many different developers over many years. It's pretty good and has lots of powerful features but over the years certain things have been allowed to slip. One problem was that you couldn't click the "Properties" tab. The reason was that it was trying to fetch properties that didn't exist anymore. What had happened was that the class attribute _properties (which is used by the "Properties" tab in the ZMI) had been stored as a persistent attribute. Here's how to solve that:

def manage_fixPropertiesProblem(self):
    """ fix so _properties becomes a class attribute instead """
    if '_properties' in self.__dict__.keys():
        del self._properties

    return "Awesome!"


try: del self._properties
except AttributeError: pass
Thank you for posting a comment

Your email will never ever be published

Related posts

V8 < TraceMonkey < SquirrelFish 23 September 2008
Why bother with MySQL... 09 October 2008
Related by Keyword:
Persistent caching with fire-and-forget updates 14 December 2011
EditArea vs. CodePress 03 January 2008
DateIndex in Zope doesn't have indexed attributes 28 October 2007
MUnderscorePatch - tired of typing manage_main? 29 November 2006
Related by Text:
My dislike for booleans and that impact on the Django Admin 01 June 2009
Annoying Safari just ate my blog 20 March 2006
How to unit test the innards of a Django view function 15 November 2008
Mocking a Python standard library 14 March 2008
Setting security declarations to Zope classes 02 February 2006