Re: [Zope-dev] pluggable brains - namespace blues
the best answers are those answered by yourself: For all who want to know it: you have to explicitely give self as an extra parameter: concerning the example below: just call: rs[0].getName(rs[0]) and it works for me. Weird, but now I can enjoy my beer.... phil *********** REPLY SEPARATOR *********** On 03.11.2000 at 12:30 Philipp Auersperg wrote: I have a problem with pluggable brains: 1. Given is a ZClass named 'Merchant' that maps to a SQL table 'Merchant' with the columns 'ID' and 'name'. 2. I the ZClass I defined a Python method 'getName' with the body: return self.name 3. I have a SQL Method with "select * from merchant" that I bind to the brain class 'Merchant' 4. I define a Python method with the following body: -------------------------------- rs=self.Merchants() return rs[0].name -------------------------------- And now the problems: That works fine, but when I want to access the Merchant's name through the its member function getName() with the following code: -------------------------------- rs=self.Merchants() return rs[0].getName() -------------------------------- then I get an AttributeError mentioning that 'name' cannot be found. when I change the getName() Python method to: return 42 it works! It seems that the namespace is somehow shreddered, I have to dig into that but if anybody can help it would spare much time! So finally my desperate question: How can I solve/workaround that problem to call methods in pluggable brains that access database-based members from a python method? thanks in advance phil
participants (1)
-
Philipp Auersperg