As Manuele says, the error is somewhere else (some unbalances bracket
before) yet this:
db.Node.createdOn.represent = lambda v: v.strftime('%d/%m/%Y') # old syntax
should be
db.Node.createdOn.represent = lambda v, row: v.strftime('%d/%m/%Y') # new
syntax
the old syntax breaks grid.
On Monday, 16 April 2012 03:25:18 UTC-5, Annet wrote:
>
> In db.py I defined a table:
>
> db.define_table('Node',
> Field('createdOn',type='datetime',writable=False,readable=False),
> migrate=False)
>
> db.Node.createdOn.default=request.now
> db.Node.createdOn.requires=IS_DATETIME(str(T('%Y-%m-%d %H:%M:%S')))
>
> Now, when I add this validator:
>
> db.Node.createdOn.represent = lambda v: v.strftime('%d/%m/%Y')
>
> ... and save the file I get a failed to compile file error because of
> invalid syntax in this line.
> What is the correct syntax?
>
> Kind regards,
>
> Annet.
>