[Zope] ZSQL Pluggable brains broke in later Zope, can't add instance attributes

Brad Clements bkc@murkworks.com
Thu, 5 Jul 2001 13:14:51 -0400


I've been using a pluggable brain with ZSQL methods to inject an instance attribute, like 
this:


class   PackageEvent:
    """Package Event Pluggable Brain"""
    def __init__(self):
        """initialize"""
        self.__dict__['eday'] = self.eventday()
#        self.eday = self.eventday()
#        setattr(self,'eday',self.eventday())

<snip>

The first method (using __dict__) used to work on 2.2, but now fails on 2.3.3

I've tried the commented out methods as well.

I get an attributeError when any of the above three methods are encountered.

I believe some new ExtensionClass magic is causing this to fail. Record.c is too 
complicated for me to figure out.

Do I need a self.__of__() something to do this?

I can't use an instance method because I need to use  <dtml-if first-eday> in my DTML 
methods.

<dtml-var first-eventday> fails of course because eventday is a bound method, not a 
string.

Any suggestions?

thanks


Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements