[Grok-dev] adding objects to context from __init__

John de la Garza john at jjdev.com
Sat Oct 4 13:21:14 EDT 2008


In the tutorial the first demo of persistent objects did this:

class Sample(grok.Application, grok.Container):
     text = 'default text'


Then as the tutorial goes on they do this:

class Sample(grok.Application, grok.Container):
     def __init__(self):
         super(Sample, self).__init__()
         self.list = []


Why don't we have to add the string the same way as the list?

I mean the variable text gets persisted between restarts of the  
server, but if we added a list by doing this:

class Sample(grok.Application, grok.Container):
     list = []


it would be reset to empty every time we restarted the server


I'd expect text='default text' to have the same resetting as list=[]


What am I over looking?


More information about the Grok-dev mailing list