[Grok-dev] model not getting persisted

Lennart Regebro regebro at gmail.com
Thu Mar 22 20:29:10 EDT 2007


On 3/23/07, Kevin Teague <kevin at bud.ca> wrote:
> The first case assigns x as a class attribute. The second case
> assigns x as an instance attribute. The ZODB only persists instance
> attributes - as far as I know?

Yup.

> class attributes are bound to the class itself, and not a particular
> instance.

And hence will be reinitialized every time you restart Zope. So this
behaviour is as it "should" be.

> Personally, I do not use class attributes as defaults for instance
> attributes, but YMMV.

I do, especially when the attribute is now, for BBB.


-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64


More information about the Grok-dev mailing list