OK. Please try trunk again.
On Nov 7, 12:20 am, Iceberg <[email protected]> wrote:
> Bad news. My app is still broken with the latest trunk, when using
> reference field. Put the following code in your model.
>
> db.define_table('task',
> Field('name'),
> )
>
> db.define_table('schedule',
> Field('task',db.task,
> represent=lambda value,tasks=dict([x.id, x.name]
> for x in db().select(db.task.ALL,cache=(cache.ram,3600*24))
> ):tasks.get(value,'')
> ),
> )
>
> Then access the table "schedule" in admin. You will encounter the
> "KeyError: '0'" again. :-(
>
> Apart from the deepcopy issue, why recent feature need to somehow
> change the cached object? I am missing the old days... :-(
>
> Regards,
> Iceberg
>
> On Nov6, 2:46am, vince <[email protected]> wrote:
>
> > thanks for your quick fix!
>
> > vince
>
> > On Nov 6, 2:42 am, mdipierro <[email protected]> wrote:
>
> > > I found the problem.
>
> > > There is, there always was, a bug in cache.ram. It was caching the
> > > original object, not a copy, so if the object gets modified the one in
> > > cache changes too.
>
> > > This bug only showed up now.
>
> > > I fixed in trunk and I will post a web2py 1.71.3 asap.
>
> > > For now you can still use the latest web2py but edit gluon/cache.py
> > > add
> > > include copy
> > > and replace
> > > self.storage[key] = (time.time(), value)
> > > with
> > > self.storage[key] = (time.time(), copy.deepcopy(value))
>
> > > Massimo
>
> > > On Nov 5, 12:37 pm, vince <[email protected]> wrote:
>
> > > > oh yes it's working without cache.
>
> > > > vince
>
> > > > On Nov 6, 2:19 am, mdipierro <[email protected]> wrote:
>
> > > > > There is good code here. Can you help me debug this?
> > > > > can you try remove cache=(...) in validators?
> > > > > Feel free to email me personally and we'll post the fix when done.
>
> > > > > Massimo
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---