Hello,

I try to cache.ram a lambda represent function like Massimo suggest in
this post :

http://www.mail-archive.com/[email protected]/msg52736.html

My problem is that there record where the field to be represent is
empty...

I was using the and/or trick before like this that was working ok :

db.table1.create_by.represent=\
    lambda value: (value!=None and "%(initials)s"
%db.auth_user[value]) or 'None'

But now, I want to speed my app a bit with cache.ram...

This work great as long as the field have been filled :

represent=lambda id: cache.ram('%id' %id,
lambda:db.auth_user(id).initials, 3600)

I try many different things, like :

represent=lambda id: cache.ram((id!=None and '%id' %id,
lambda:db.auth_user(id).initials) or 'None', 3600)
# NOT WORKING CAUSE : TypeError: 'int' object is not callable

represent=lambda id: cache.ram('%id' %id,
lambda:db.auth_user(id).initials if id!=None else 'None', 3600)
# NOT WORKING CAUSE : TypeError: %d format: a number is required, not
NoneType

Also try with function...

Any idea...

Thanks

Richard

Reply via email to