[Grok-dev] Persistence issue with grok.Model
Brandon Craig Rhodes
brandon at rhodesmill.org
Mon Dec 29 16:08:41 EST 2008
Andreas Jung <lists at zopyx.com> writes:
> I am current encountering a persistence issue ... The instance dict of
> a Job instance holds the **kw dict until I restart my Grok instance.
> After the restart the instance dict is empty.
Could the ZODB simply be lazy about re-populating the object attributes
until you first cause a "getattr" by trying to look at one of them? Try
adjusting that last method of yours to this:
def getJobs(self):
lst = list()
for id, job in self.context['accounting'].items():
print id, job.__dict__
try:
a = job.a
except AttributeError:
pass
print id, job.__dict__
lst.append(job.__dict__.copy())
return lst
If ZODB efficient/lazy loading is the problem, then the second "print"
statement should find the attributes populated.
--
Brandon Craig Rhodes brandon at rhodesmill.org http://rhodesmill.org/brandon
More information about the Grok-dev
mailing list