[Grok-dev] Persistence issue with grok.Model
    Uli Fouquet 
    uli at gnufix.de
       
    Tue Dec 30 08:19:12 EST 2008
    
    
  
Hi there,
Brandon Craig Rhodes wrote:
> 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?
That's what I would suspect too.
>   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
Or you replace
  job.__dict__
simply by
  job.__getattribute__('__dict__')
which should really update the object.
Best regards,
-- 
Uli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20081230/751d9b81/attachment.bin 
    
    
More information about the Grok-dev
mailing list