[ZODB-Dev] [Fixed?] _p_jar magic stopped working
   
    Jim Fulton
     
    jim@zope.com
       
    Sun, 11 Aug 2002 07:20:32 -0400
    
    
  
Ross Boylan wrote:
> On Sat, Aug 10, 2002 at 08:10:42AM -0400, Jim Fulton wrote:
> 
>>>P.S. The docs say _p_jar is None if the object has not been saved,
>>>
>>Right.
>>
>>
>>>but
>>>it appears to be a valid Connection even with the object created in
>>>the same transaction.
>>>
>>I think you are mistaken.
>>
>>Jim
>>
>>
> 
> def manage_CredentialElectorate_add(container, id, title=None, length=8, voters=None, REQUEST=None):
>     "Add the indicated electorate"
>     electors = CredentialElectorate(id, title, length)
>     print electors._p_jar
>     container.Destination()._setObject(id, electors)
>     print electors._p_jar
>     electors.addVotersFromGUI(voters, container.Destination())
>     if REQUEST:
>         REQUEST.RESPONSE.redirect('manage_main')
> 
> The first _p_jar is None, but the second is
> <ZODB.Connection.Connection instance at 0x8c4997c>.  So apparently
> something in _setObject set this up.
> 
This is possible. Zope Zope objects set _p_jar. This is not a ZODB
behavior though.
Jim
-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org