default=auth.user.first_name if auth.user else 'some_other_default'
or
default=auth.user and auth.user.first_name or 'some_other_default'
Anthony
On Saturday, October 29, 2011 6:10:34 PM UTC-4, Pystar wrote:
>
> In an app I am developing, in my database definition I have a filed
> whose defaul
thanks
On Oct 29, 11:46 pm, Anthony wrote:
> default=auth.user.first_name if auth.user else 'some_other_default'
>
> or
>
> default=auth.user and auth.user.first_name or 'some_other_default'
>
> Anthony
>
>
>
>
>
>
>
> On Saturday, October 29, 2011 6:10:34 PM UTC-4, Pystar wrote:
>
> > In an app
I actually did this and it worked,
I put this at the top of my module file:
def func():
if auth.user == None:
return "Anon"
else:
return auth.user.first_name
and in my table definition I did this:
Field("auctioner", "string", default = func(), required=True,
readable=False
On Saturday, October 29, 2011 6:58:53 PM UTC-4, Pystar wrote:
>
> I actually did this and it worked,
>
> I put this at the top of my module file:
> def func():
> if auth.user == None:
> return "Anon"
> else:
> return auth.user.first_name
>
Seems like overkill, particu
4 matches
Mail list logo