[ZODB-Dev] Writing Persistent Class

Kenneth Miller xkenneth at gmail.com
Fri Jan 18 16:51:27 EST 2008


All,

      Yes, i realised that a little while ago. Thanks a ton for all of  
the responses. My solution was to use deepcopy to make a copy of the  
object to use for something else later on, is this appropriate?

Regards,
Kenneth Miller

On Jan 18, 2008, at 3:43 PM, Marius Gedminas wrote:

> On Thu, Jan 17, 2008 at 07:08:19PM -0600, Kenneth Miller wrote:
>> There error i receive seems to have a problem with my __eq__ method.
>>
>> Here's the error I get when I do subclass persistent:
>>
>> .......No handlers could be found for logger "ZODB.Connection"
>> E
>> = 
>> =====================================================================
>> ERROR: testPersistence (__main__.ToolDataTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>  File "Objects.py", line 1412, in testPersistence
>>    self.failUnlessEqual(readFromFS(),td)
>>  File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
>> python2.5/unittest.py",
>> line 332, in failUnlessEqual
>>    if not first == second:
>>  File "Objects.py", line 1278, in __eq__
>> 	!!!!Below is where it's choking on my __eq__ method!!!
>>    return self.name == other.name and self.value == other.value and
>> mx 
>> .DateTime 
>> .cmp(self.timeStamp,other.timeStamp,Globals.AvgTimePrec)==0 and
>> self.slowData == other.slowData
>>  File
>> "/Library/Python/2.5/site-packages/ZODB3-3.7.2-py2.5-macosx-10.5- 
>> i386.egg/ZODB/Connection.py",
>> line 758, in setstate
>>    raise ConnectionStateError(msg)
>> ConnectionStateError: Shouldn't load state for 0x01 when the  
>> connection is
>> closed
>
> It seems that you're keeping a reference to a persistent object after
> you close the ZODB connection.  Don't do that.
>
> Marius Gedminas
> -- 
> If Linux doesn't have the solution, you have the wrong problem.
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev



More information about the ZODB-Dev mailing list