问题描述
Ubuntu 18 - Python 3.6.9 - 蒙戈 4
使用 Web2py 提供的 sqlFORM 我在 pydal 中遇到错误:
AttributeError: 'Table' 对象没有属性 '_notnulls'
我正在使用我的 auth.user 表来制作表单,它正在与我的应用程序的其余部分一起使用,除非将它与 sqlFORM 一起使用并尝试处理()。
这是我抛出错误的代码,代码是表单的标准 web2py 实践:
def my_form_processing(form):
pass
db.auth_user.modified_by.writable = False
db.auth_user.created_by.writable = False
form = sqlFORM(db.auth_user)
if form.process(onvalidation=my_form_processing).accepted:
session.flash = 'Record inserted'
redirect(URL())
elif form.errors:
response.flash = 'Form has errors'
else:
session.flash = 'Please fill the form'
return dict(form=form)
这是回溯:
Traceback (most recent call last):
File "/opt/web2py/gluon/restricted.py",line 219,in restricted
exec(ccode,environment)
File "/opt/web2py/applications/connexxion/controllers/admin.py",line 380,in <module>
File "/opt/web2py/gluon/globals.py",line 430,in <lambda>
self._caller = lambda f: f()
File "/opt/web2py/gluon/tools.py",line 3878,in f
return action(*a,**b)
File "/opt/web2py/applications/connexxion/controllers/admin.py",line 128,in adduser
if form.process(onvalidation=my_form_processing).accepted:
File "/opt/web2py/gluon/html.py",line 2339,in process
self.validate(**kwargs)
File "/opt/web2py/gluon/html.py",line 2277,in validate
if self.accepts(**kwargs):
File "/opt/web2py/gluon/sqlhtml.py",line 1994,in accepts
self.vars.id = self.table.insert(**fields)
File "/opt/web2py/gluon/packages/dal/pydal/objects.py",line 892,in insert
ret = self._db._adapter.insert(self,row.op_values())
File "/opt/web2py/gluon/packages/dal/pydal/adapters/mongo.py",line 475,in insert
raise e
File "/opt/web2py/gluon/packages/dal/pydal/adapters/mongo.py",line 471,in insert
self.check_notnull(table,values)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/mongo.py",line 422,in check_notnull
for fieldname in table._notnulls:
AttributeError: 'Table' object has no attribute '_notnulls'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)