import table_test
def test():
return table_test.testfrom gluon.dal import *
from gluon.validators import *
from gluon import current
import field_constructor
db = DAL('sqlite://test.sqlite', pool_size = 1)
def on_define_test(table):
T = current.T
table.test.label = T('Test')
table.test.requires = IS_NOT_EMPTY()
table.test.widget = field_constructor.widget_string
test = db.define_table('test',
Field('test'),
on_define = on_define_test)from gluon import *
widget_string = lambda field, value: \
SQLFORM.widgets.string.widget(field, value,
_class = "form-control string",
_placeholder = current.T('Should be filled') )ERROR:Rocket.Errors.Thread-6:Traceback (most recent call last):
File "/Users/sugizo/learn/python/web2py/gluon/rocket.py", line 1288, in run
self.run_app(conn)
File "/Users/sugizo/learn/python/web2py/gluon/rocket.py", line 1802, in run_app
self.write(data, sections)
File "/Users/sugizo/learn/python/web2py/gluon/rocket.py", line 1722, in write
self.conn.sendall(b'%x\r\n%s\r\n' % (len(data), to_bytes(data, 'ISO-8859-1')))
TypeError: object of type 'Field' has no len()python ~/learn/python/web2py/web2py.py --nogui --no-banner -a a -i 0.0.0.0 -p 8000