DataError is not a web2py or a python error. It is an error from the
driver. I suspect you have an "integer" field which you changed to
"string". Web2py knows about the change but the database does not and
refuses to store a string in it. Delete everything under "databases". You
will lose data but you will have a clean migration.
On Monday, 13 January 2014 08:09:29 UTC-6, Neil wrote:
>
> I'm having a problem that I can't get to the bottom of. The crash happens
> when a user submits an automatically generated SQLFORM. Here is the
> traceback from the ticket:
>
> File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py", line
> 2189, in process
> self.validate(**kwargs)
> File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py", line
> 2128, in validate
> if self.accepts(**kwargs):
> File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/sqlhtml.py",
> line 1571, in accepts
> self.vars.id = self.table.insert(**fields)
> File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py", line
> 8598, in insert
> ret = self._db._adapter.insert(self, self._listify(fields))
> File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py", line
> 1210, in insert
> raise e
> DataError: integer out of range
>
>
> Here is the table:
>
> db.define_table('user_demographics',
> Field('sex', type='string', length=8),
> Field('year_of_birth', type='integer'),
> Field('country', type='string', length=25),
> Field('therapist_1', type='string', length=5),
> Field('therapist_2', type='string', length=5),
> Field('medication', type='string', length=5),
> Field('find_out', type='string'),
> Field('find_out_2', type='text', length=1000),)
>
> and here is the code:
>
> @auth.requires_login()
> def user_main():
> user_form = SQLFORM(db.user_demographics)
> if user_form.process().accepted:
> redirect(URL(r=request, c='social_anxiety', f='page', vars=dict(
> page_id=next_page_id)))
> elif user_form.errors:
> response.flash = 'Please take a look at your answers'
>
> Some notes that might be relevant:
>
> - There is only one user who has this problem (thousands of other
> users have used the system successfully). However, they have it
> *consistently*. Furthermore, this is just one example - they have
> problems with any form with text/string input.
> - *I can't reproduce the error*. e.g. If I try to put in a really
> small/large integer for the year, it is always handled gracefully. If I
> disable JavaScript, the validator still comes back with useful error
> messages.
> - The user is in a non-English country
>
> Based on this, I do not think the problem is the input, but something
> specific to this particular user's system (OS + browser). Any ideas on how
> I might reproduce this? I'm stumped.
>
> To make matters worse, I have very limited opportunity to debug with the
> user's assistance.
>
> Thanks
> Neil
>
--
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/groups/opt_out.