PluggableBrains weirdness
Another question about these PluggableBrains I'm developing for my application. I haven't been able to find much definitive, complete documentation on the subject anywhere. So I'm pretty much figuring it out by trial-and error. My class has an __init__ method like so: def __init__(self): "Initialize class" self._badmsgs = {} # function: reason # Validation info... self._invalidated = False # Have we been specifically invalidated by a set function? self._valid = True # Are we valid? When I access a query using this Brains class, I get an AttributeError complaining about _badmsgs. What is causing this? It occurs even if I declare _badmsgs = {} outside the __init__ function.
Michael Ekstrand wrote at 2004-7-23 13:54 -0500:
Another question about these PluggableBrains I'm developing for my application.
I haven't been able to find much definitive, complete documentation on the subject anywhere. So I'm pretty much figuring it out by trial-and error.
My class has an __init__ method like so:
def __init__(self): "Initialize class" self._badmsgs = {} # function: reason # Validation info... self._invalidated = False # Have we been specifically invalidated by a set function? self._valid = True # Are we valid?
When I access a query using this Brains class, I get an AttributeError complaining about _badmsgs. What is causing this? It occurs even if I declare _badmsgs = {}
A well known (extremely old collector entry) misfeature of the "record" class used to implement Z SQL Method result rows: their instances do not have a "__dict__" and therefore cannot store attributes other than the result fields. -- Dieter
On Sunday 25 July 2004 17:12, Dieter Maurer wrote:
A well known (extremely old collector entry) misfeature of the "record" class used to implement Z SQL Method result rows: their instances do not have a "__dict__" and therefore cannot store attributes other than the result fields.
Hmm... is there a way I can bypass this? Creatively, perhaps? My class is implementing some data validation functions, and needs to have a few instance variables to keep track of its internal state. A few things are coming to mind - is there something I can do with a an inner class, a global dictionary, or something like that? Thanks, Michael
participants (2)
-
Dieter Maurer -
Michael Ekstrand