Here's what SQLFORM.grid does: 
https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#2479

On Tuesday, April 2, 2013 10:47:10 PM UTC-4, Anthony wrote:
>
> I think you just have to test for the type, for example:
>
> db.Shops._format(db.Person[x]) if callable(db.Shops._format) else db.Shops
> ._format % db.Person[x]
>
> Anthony
>
> On Tuesday, April 2, 2013 8:45:30 PM UTC-4, Jurgis Pralgauskis wrote:
>>
>> Hi, lets say I have:
>>
>> db.define_table('Person',
>>     Field('name', 'string'),
>>     format="%(name)s"
>>     # or could be
>>     # format=lambda self: self.name or "Anonymous"
>> )
>>
>> whats the best way to apply format
>> if I don't know which way format was specified?
>>
>> for string: 
>>    db.Shops._format %  db.Person[x]  
>>
>> for lambda: 
>>    db.Shops._format( db.Person[x]  )
>>
>> I could make some helper function, but maybe there's a direct way?
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to