I have a datetime field I want to represent differently using a lambda 
function. Instead of datetime, I want a timedelta. This was not a problem 
with version 1.99.x but is a problem with 2.1.1 because grid tries to do a 
row.year, which throws this ticket:

Traceback (most recent call last):
  File "N:\web2py\gluon\restricted.py", line 209, in restricted
    exec ccode in environment
  File "N:/web2py/applications/mya/controllers/myc.py" 
<http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py>, line 663, in 
<module>
  File "N:\web2py\gluon\globals.py", line 187, in <lambda>
    self._caller = lambda f: f()
  File "N:\web2py\gluon\tools.py", line 2838, in f
    return action(*a, **b)
  File "N:/web2py/applications/mya/controllers/myc.py" 
<http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py>, line 191, in 
list_stuff
    ui='web2py',
  File "N:\web2py\gluon\sqlhtml.py", line 2108, in grid
    value = field.formatter(value)
  File "N:\web2py\gluon\dal.py", line 8605, in formatter
    value = item.formatter(value)
  File "N:\web2py\gluon\validators.py", line 2529, in formatter
    return self.other.formatter(value)
  File "N:\web2py\gluon\validators.py", line 2220, in formatter
    year = value.year
AttributeError: 'datetime.timedelta' object has no attribute 'year'


Are we no longer supposed to use lambda functions to reformat our tables 
when grid is involved?

-- 



Reply via email to