Possible Bug, was Re: [Zope] PersistentMapping is confusing

Paul Winkler slinkp23@yahoo.com
Tue, 13 Nov 2001 20:02:59 -0500


Two updates:

1) I forgot to list my setup:

Zope 2.4.3 compiled from source
Python 2.1.1
Linux 2.4.14

2) I should have chosen a more attention-getting subject; the behavior
I'm getting is not just confusing, I think it's a bug in ZODB and/or
PersistentMapping.

On Tue, Nov 13, 2001 at 03:49:13PM -0500, Paul Winkler wrote:
> In my Product, I store some data in a PersistentMapping.  I wanted to
> directly store references to other Zope objects. This behaves
> strangely: objects accessed via this PersistentMapping are fine until
> zope restarts. After restart, if I try to retrieve objects from the
> PersistentMapping, I get:
> 
> Error Type: AttributeError
> Error Value: get
> 
> As a workaround, I store the ID of the desired object in my
> PersistentMapping as a string and then use getattr to retrieve the
> object later. This works fine. But it's more work and I don't
> understand why it's necessary. Apparently, you can't directly store
> ZODB object references in a PersistentMapping.
> 
> Is this expected behavior, or a bug? It seems very un-pythonic to me,
> and I see no mention of this behavior in the DevGuide or anywhere else
> that I've looked.
> 
> To reproduce this bug/feature, I've created a very stripped-down product
> that's available here:
> http://www.slinkp.com/weirdness.zip
> 
> To try it:
> 
> You need PageTemplates installed.
> 
> Unzip weirdness.zip in your Products directory.
> 
> In a scratch folder, add a WeirdnessDemo from the management interface.
> 
> Click on the new WeirdnessDemo.
> 
> Both the links displayed work fine, right?
> 
> Now add an image using the form provided.
> 
> Both the links still work fine, right?
> 
> Now restart Zope.
> 
> Go back to the WeirdnessDemo object.
> 
> The first link still works, the second one gives an AttributeError.
> 
> -- 
> 
> paul winkler
> home:  http://www.slinkp.com
> music: http://www.reacharms.com
> calendars: http://www.calendargalaxy.com
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 

paul winkler
home:  http://www.slinkp.com
music: http://www.reacharms.com
calendars: http://www.calendargalaxy.com