SQLField('created_by',db.auth_user,default=session.auth.user.id if
auth.is_logged_in() else 0,writable=False)

Massimo

On Feb 25, 8:21 am, Fran <francisb...@googlemail.com> wrote:
> I know that created_on/modified_on can be replicated using:
> SQLField("modified_by","datetime",default=request.now,
> update=request.now, writable=False)
>
> However I am struggling to replicate created_by/modified_by.
> This works fine when logged-in, but breaks when logged-out:
> SQLField
> ('created_by',db.auth_user,default=session.auth.user.id,writable=False)
> default can't take a lambda form like lambda session: (session and
> [session.auth.user.id] or ["Anonymous"])[0].
>
> Anything we can do here other than doing a T2-style check for fields
> of this name within the CRUD class in tools.py?
> (or simply writing our own wrapper around CRUD, of course)
>
> F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to