Hi! I try to define subclass of Table: model.py: --------------------------------- db=DAL('sqlite://...')
from dal.objects import Table , Field class my_tab(Table): def __init__(self, db, tablename, *fields, **args): fields=( Field('num', 'integer'), Field('ident','string'), ) Table.__init__(self, db, tablename, *fields, **args) db.define_table('my_tab_obj', table_class=my_tab) ------------------------------------ It works!, but if remove 'Field' from import statement It crashes: File "D:\web2py\gluon\dal\objects.py", line 327, in __init__ 'define_table argument is not a Field or Table: %s' % field) SyntaxError: define_table argument is not a Field or Table: <no table>.num definition like 'db.define_table('my_tab_obj', Field(...) ... )' - works It seems, there is difference between Field-class exposes by default and by direct import statement. I.e. Field instance of subclass is not instance of Field defined in dal.objects Is this a bug? (2.9.12-stable+timestamp.2015.01.17.06.11.03) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.