try to prefix yourself with the following situation
db.define_table('sometable', Field('somefield1'), Field('somefield2'))
and then request.vars as
{'somefield1' : 'abcd', 'somefield2' : 'cdef', '*contents*': 'wxyz'}
trying to do db.sometable.validate_and_insert(**request.vars)
will give you the exact same error ("Field *contents *does not belong to
the table")
On Monday, May 9, 2016 at 3:11:51 PM UTC+2, Mark Billion wrote:
>
> Dumb question and even though I have rtmed I cannot seem to find what I am
> sure is right in front of me.
>
> I have a form that sends back data ordered by table name and I want to do
> something like
>
> validate_and_insert(**request.vars)
>
> That being said, this doesnt work....
>
>
>
> <type 'exceptions.SyntaxError'> Field contents does not belong to the table
> Version
> web2py™ Version 2.12.3-stable+timestamp.2015.08.19.00.18.03
> Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/t4/controllers/default.py"
> <https://104.131.18.58/admin/default/edit/t4/controllers/default.py>, line
> 3560, in <module>
> File "/home/www-data/web2py/gluon/globals.py", line 412, in <lambda>
> self._caller = lambda f: f()
> File "/home/www-data/web2py/applications/t4/controllers/default.py"
> <https://104.131.18.58/admin/default/edit/t4/controllers/default.py>, line
> 28, in storage_form_controller
> ret = db.storage_lockers.insert(**request.vars)
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 712,
> in insert
> ret = self._db._adapter.insert(self, self._listify(fields))
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 629,
> in _listify
> 'Field %s does not belong to the table' % name)
> SyntaxError: Field contents does not belong to the table
>
> Error snapshot [image: help]
> <https://104.131.18.58/admin/default/ticket/t4/75.150.158.78.2016-05-09.09-05-42.8ad1ae83-9f51-4100-b978-04eda00ba5c5#>
>
> Locals:
> eld : <pydal.objects.Field object>
> fields : {'bank_name_address': 'd', 'client': '9', 'contents': '1141',
> 'date_surrender_or_trans': '1', 'id': '', 'kind': 'Storage Locker',
> 'others_with_access': 'dte'}
> name : 'contents'
> new_fields : {'bank_name_address': (<pydal.objects.Field object>, 'd'),
> 'client': (<pydal.objects.Field object>, '9'), 'date_surrender_or_trans':
> (<pydal.objects.Field object>, '1'), 'id': (<pydal.objects.Field object>,
> ''), 'kind': (<pydal.objects.Field object>, 'Storage Locker')}
> self : <Table storage_lockers
> (id,client,kind,others_wi...ntents_5,date_surrender_or_trans,content_string)>
> update : False
> value : ''
>
--
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.