[Zope] how to call sql methods from a product?
Dieter Maurer
dieter at handshake.de
Mon Feb 23 13:48:32 EST 2004
Please always stay on the mailing list! Readded...
Alexander B. wrote at 2004-2-22 12:27 -0800:
> ...
>anyway, after all these experiments I cant open a
>folder where I put this class. I
>Traceback (innermost last):
> ...
> Module ZODB.Connection, line 554, in setstate
> Module ZODB.Connection, line 590, in
>_set_ghost_state
>SystemError: Failed to import class r from module
>Record
>
>is there any way to fix it ?
It seems that you stored the result of a Z SQL Method
as an attribute of a persistent object.
This is impossible as such instances cannot be unpickled
(aka unserialized).
It might not be easy to fix this problem.
If you are lucky, the fatal modification is still listed
in your "Undo" tab. In this case, undo the respective
transaction.
If not, a bit of surgery will be necessary to get rid of
the attribute again. There is a HowTo around (I think on
ZopeLabs) that explains how to get rid of an object
causing a "POSKeyError". A similar approach can be used
to get rid of your problematic attribute.
BEWARE: do not store Z SQL Method results as part of
any persistent object (this also implies: do not store it
in a session).
By the way: the code fragment you posted seems innocent
(with respect to your current problem). The true problem
must be elsewhere.
>> >class testclass(SimpleItem, Folder):
>> >...
>> > def getTable(self,REQUEST=None):
>> > "get table with results"
>> > self.parm1=0
>> > self.REQUEST.set('sql',self.sql())
>> >
>> > if REQUEST is not None: return
>>
>> >
>> > self.showResult_html(self, REQUEST)
--
Dieter
More information about the Zope
mailing list