[Grok-dev] model not getting persisted

Tim Terlegård tim at se.linux.org
Fri Mar 23 17:53:58 EDT 2007


> >Check for instance how lastName etc are initialized in the Contact class
> >here: http://dc.ubuntu-us.org/bazaar/zope3class/html/lesson03/index.html
> >
> >and how fullname is initialized here:
> >http://wiki.zope.org/zope3/HowDoIModifyAnExistingPersistentObject
> >
> I tried to write an explanation, but failed. So I'll explain with
> code, and hop it explains it:
> 
> >>>class Foo:
> ...   bar = []
> ...
> >>>foo1 = Foo()
> >>>foo2 = Foo()

[snip]

> In the first case you are modifying an object set as an attribute on
> the class. In the second case you are setting an attribute on the
> instance.

Ok, I understand this. But how is the zope3 code working then? I've seen
this

class X(Persistent):
   implements(ISomeSchema)

   a = u''
   b = u''

a couple of times. How come the class attributes gets persisted here?

Tim


More information about the Grok-dev mailing list