I have code in my db.py model to add fields to auth_user:
auth_extras = [
Field('paid', 'boolean',writable=False,readable=False),
Field('paidwhen', 'date',writable=False,readable=False),
Field('paidamount', 'float',writable=False,readable=False),
Field('paymentid',writable=False,readable=False),
Field('paidYears','list:integer',default=list(),
writable=False,readable=False )
]
auth.settings.extra_fields['auth_user'] = auth_extras
auth.define_tables(username=False, signature=False)
Which worked fine, until I upgraded to 2.15.3; now I get:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
Traceback (most recent call last):
File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in
restricted
exec(ccode, environment)
File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py"
<http://127.0.0.1:8001/admin/default/edit/init/models/menu.py>, line 178, in
<module>
if DEVELOPMENT_MENU: _()
File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py"
<http://127.0.0.1:8001/admin/default/edit/init/models/menu.py>, line 49, in _
if auth.has_membership('admin'):
File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in
has_membership
membership = self.table_membership()
File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in
table_membership
return self.db[self.settings.table_membership_name]
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 663, in __getitem__
return self.__getattr__(str(key))
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 603, in lazy_define_table
table._create_references()
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py",
line 456, in _create_references
rtable = db[rtablename]
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 663, in __getitem__
return self.__getattr__(str(key))
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py",
line 599, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py",
line 351, in __init__
field.bind(self)
File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py",
line 1633, in bind
'Field %s is already bound to a table' % self.longname)
ValueError: Field auth_user.paid is already bound to a table
Which is true, but web2py used to know that. Doesn't matter if migrations
are enabled or not; I get the same part of the trace from the call to self.
lazy_define_table if I comment out the call to auth.has_membership.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.