[Grok-dev] Re: model not getting persisted

Martijn Faassen faassen at startifact.com
Fri Mar 23 17:15:21 EDT 2007


Martijn Faassen wrote:
> Lennart Regebro wrote:
>> 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.
> 
> You'd still want to avoid it. It's a good one for the tutorial to at 
> least briefly mention

I now briefly mention this in the tutorial (in SVN).

Regards,

Martijn



More information about the Grok-dev mailing list