[Zope] bug in pluggable brains ?

Geir Bækholt Geir Bækholt
Thu, 9 May 2002 23:06:37 +0200


Zopistas,

There seems to be a bug in the machinery for attribute assignement for
pluggable brains with ZSQLmethods: I can use Pluggable Brains and their
methods , but whenever i try to assign a value to an attribute,
AttributeError is raised.

i have narrowed my testcase down to the following:

simplest ZSQLmethod possible :
SELECT 'testBrain' AS t FROM DUAL

When using the following class definition:
class Test:
    def __init__(self):
        pass
    def __repr__(self):
        return "i am a pluggable brain"
everything works as expected.

if i do this :
class Test:
    def __init__(self):
        self.teststring = "test"
        
it raises an AttributeError

Am i not supposed to use attribute assignment in brains , or is it a
bug ? - i cannot seem to find much documentation on the subject..

All information appreciated
:)

traceback follows:

Traceback (innermost last):
  File /usr/home/geir/zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module
  File /usr/home/geir/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/home/geir/zope/lib/python/Zope/__init__.py, line 226, in zpublisher_exception_hook
    (Object: LockableItem)
  File /usr/home/geir/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/home/geir/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: te)
  File /usr/home/geir/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
    (Object: te)
  File /usr/home/geir/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
    (Object: te)
  File /usr/home/geir/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec
    (Object: te)
  File /usr/home/geir/zope/lib/python/Products/PythonScripts/PythonScript.py, line 363, in _exec
    (Object: te)
    (Info: ({'script': <PythonScript instance at 8f81f60>, 'context': <Folder instance at 90c8f20>, 'container': <Folder instance at 90c8f20>, 'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 1, in te
    (Object: guarded_getitem)
  File /usr/home/geir/zope/lib/python/AccessControl/ZopeGuards.py, line 151, in guarded_getitem
  File /usr/home/geir/zope/lib/python/Shared/DC/ZRDB/Results.py, line 175, in __getitem__
  File /usr/home/geir/zope/lib/python/Shared/DC/ZRDB/Results.py, line 158, in __init__
    (Object: Test)
  File /usr/home/geir/zope/Extensions/test.py, line 5, in __init__
    (Object: Test)
AttributeError: (see above)

-- 
Geir Bækholt                       web-developer
geirh@funcom.com             funcom oslo | webdev-team