[Zope] What kind of attributes can be put inside a simple item
Andreas Jung
lists at andreas-jung.com
Fri Feb 18 04:45:50 EST 2005
--On Freitag, 18. Februar 2005 10:36 Uhr +0100 Marco Bizzarri
<m.bizzarri at icube.it> wrote:
> Hi all.
>
> I'm little surprised by the possibility to insert non-persistent
> instances inside persistent object. I mean:
Who says that?
>
> class Alfa:
> def __init__(self):
> self.x = 1
> self.y = 2
>
>
> class Beta(SimpleItem):
> def __init__(self):
> self.id = 'anId'
> self.anAlfa = Alfa()
This is working fine.
>
>
> I always understood that I could not put Alfa instances inside a Beta
> class, because the ZODB machinery did not understood how to pickle them.
> But I did some experiments recently, and it looks like the above example
> should work.
The problem with persistent objects is that you should know what you are
doing if
you use *persistent* objects as attributes.
>
> Could anyone provide some insight on this topic?
>
First tell us what leads you to the *your* opinion.
-aj
More information about the Zope
mailing list