Hello,
I have following table with custom type (database: postgres):
from gluon.sql import SQLCustomType
inet = SQLCustomType ( type='string', native='inet', encoder=lambda x:
repr(str(x)))
db.define_table("serwery",
Field("id_klienci",db.klienci),
Field("ip_serwera",type=inet,requires = IS_IPV4()))
When I try to use SQLFORM.grid, like this:
@auth.requires_login()
def dodajserwer():
response.flash = T('Serwery')
form=SQLFORM.grid(db.serwery)
if form.accepts(request.vars, session):
response.flash='Serwer dodany'
elif form.errors:
response.flash = 'popraw'
return dict(form=form)
I get following error:
Traceback (most recent call last):
File "/home/users/brushek/web2py/gluon/restricted.py", line 194, in
restricted
exec ccode in environment
File "/home/users/brushek/web2py/applications/welcome/controllers/
default.py", line 138, in <module>
File "/home/users/brushek/web2py/gluon/globals.py", line 145, in
<lambda>
self._caller = lambda f: f()
File "/home/users/brushek/web2py/gluon/tools.py", line 2510, in f
return action(*a, **b)
File "/home/users/brushek/web2py/applications/welcome/controllers/
default.py", line 60, in dodajserwer
form=SQLFORM.grid(db.serwery)
File "/home/users/brushek/web2py/gluon/sqlhtml.py", line 1430, in
grid
T = current.T
TypeError: reduce() of empty sequence with no initial value
Where can be problem ?
regards
brushek