>
> File "/Users/annet/web2py/gluon/dal.py", line 7103, in lazy_define_table

    table = table_class(self, tablename, *fields, **args)
>   File "/Users/annet/web2py/gluon/dal.py", line 7512, in __init__
>     self[field_name] = field
>   File "/Users/annet/web2py/gluon/dal.py", line 7680, in __setitem__
>     .update(**self._filter_fields(value)) is None:
>   File "/Users/annet/web2py/gluon/dal.py", line 7606, in _filter_fields
>     return dict([(k, v) for (k, v) in record.iteritems() if k
> AttributeError: 'Field' object has no attribute 'iteritems'
>
>
In your code, you have:

fields_list.append(Field(name=str(r.nav.id),type='boolean',default=r.nodeNav
.frontend,label=r.nav.name))

That results in field names that are numbers, which is not allowed. 
SQLFORM.factory creates a dummy DAL and db table. When the table is 
created, there is this line:

self[field_name] = field

When the field name is an integer, the above is equivalent to something 
like:

db.table_name[1] = field

The DAL interprets that as an attempt to update record 1 of db.table_name, 
so it is expecting field to be a dictionary-like object with an iteritems() 
method rather than a field.

Anthony

-- 



Reply via email to