Thanks. It's also throwing the identical error when using the app's web page as a logged in user.
Suggestions? On Mon, Jun 5, 2017 at 10:19 AM, Anthony <abasta...@gmail.com> wrote: > The problem is that you have auth.signature but are doing inserts without > a logged in user. As a result, the values of the created_by and modified_by > fields are None but are required to be id's from the db.auth_user table. > This should simply result in a failed validation rather than an exception, > but the IS_IN_DB validator breaks when None values are passed in for id or > integer fields (I would consider it a bug). > > Anthony > > > On Saturday, June 3, 2017 at 2:17:31 PM UTC-4, Jordan Ladora wrote: > >> Yes, I was able to reproduce with a fresh install of web2py- >> >> Here's what I did- >> ------------------------------------------------------------ >> ------------------------- >> extracted new copy of web2py from DL src >> >> modified welcome app- >> in models/db.py commented out this block- >> if not request.env.web2py_runtime_gae: / else: >> ..and replaced with- >> db = DAL('sqlite://storage.sqlite', lazy_tables=True, >> ignore_field_case=False, pool_size=10, check_reserved=['postgres', >> 'postgres_nonreserved']) >> >> created models/db_data.py and added- >> >> db.define_table('datatable', >> Field('title', length=128), >> Field('name', requires=IS_IN_SET(['a','b','c'], multiple=False, >> zero=None), readable=False, writable=False, length=128), >> Field('dtype', requires=IS_IN_SET(['1','2','3'], multiple=False), >> label="Type", readable=False, writable=False, length=128), >> Field('finished', 'boolean', default=False, readable=False, >> writable=False), >> Field('the_timestamp', 'datetime', readable=False, writable=False), >> Field('alive', 'boolean', default=True, readable=False, >> writable=False), >> Field( 'comments', 'text' ), >> auth.signature, migrate=True, >> format = '%(title)s %(datatype)s %(species)s' >> ) >> >> created welcome/databases folder >> >> >> ------------ >> >> launched with- >> >> python '.../web2py.py' -S welcome -M >> >> >>> from datetime import datetime >> >> ## insert two fields- >> >>> new_record = db.datatable.validate_and_insert(dtype='1', >> the_timestamp=datetime.utcnow()) >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File ".../gluon/packages/dal/pydal/objects.py", line 749, in >> validate_and_insert >> response, new_fields = self._validate_fields(fields) >> File ".../gluon/packages/dal/pydal/objects.py", line 741, in >> _validate_fields >> value, error = self[fieldname].validate(raw_value) >> File ".../gluon/packages/dal/pydal/objects.py", line 1634, in validate >> (value, error) = validator(value) >> File ".../gluon/validators.py", line 660, in __call__ >> if isinstance(value, (int, long)) or value.isdigit(): >> AttributeError: 'NoneType' object has no attribute 'isdigit' >> >> >> ## no fields- >> >>> new_record = db.datatable.validate_and_insert() >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File ".../gluon/packages/dal/pydal/objects.py", line 749, in >> validate_and_insert >> response, new_fields = self._validate_fields(fields) >> File ".../gluon/packages/dal/pydal/objects.py", line 741, in >> _validate_fields >> value, error = self[fieldname].validate(raw_value) >> File ".../gluon/packages/dal/pydal/objects.py", line 1634, in validate >> (value, error) = validator(value) >> File ".../gluon/validators.py", line 660, in __call__ >> if isinstance(value, (int, long)) or value.isdigit(): >> AttributeError: 'NoneType' object has no attribute 'isdigit' >> >> >> ## 'name' field here should throw error for not being in set defined by >> model- >> >>> new_record = db.datatable.validate_and_insert(title='test title', >> name='test name', dtype='1', finished=False, the_timestamp=datetime.utcnow(), >> alive=True, comments='this is a test') >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File ".../gluon/packages/dal/pydal/objects.py", line 749, in >> validate_and_insert >> response, new_fields = self._validate_fields(fields) >> File ".../gluon/packages/dal/pydal/objects.py", line 741, in >> _validate_fields >> value, error = self[fieldname].validate(raw_value) >> File ".../gluon/packages/dal/pydal/objects.py", line 1634, in validate >> (value, error) = validator(value) >> File ".../gluon/validators.py", line 660, in __call__ >> if isinstance(value, (int, long)) or value.isdigit(): >> AttributeError: 'NoneType' object has no attribute 'isdigit' >> >> >> ## all fields- >> >>> new_record = db.datatable.validate_and_insert(title='test title', >> name='a', dtype='1', finished=False, the_timestamp=datetime.utcnow(), >> alive=True, comments='this is a test') >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File ".../gluon/packages/dal/pydal/objects.py", line 749, in >> validate_and_insert >> response, new_fields = self._validate_fields(fields) >> File ".../gluon/packages/dal/pydal/objects.py", line 741, in >> _validate_fields >> value, error = self[fieldname].validate(raw_value) >> File ".../gluon/packages/dal/pydal/objects.py", line 1634, in validate >> (value, error) = validator(value) >> File ".../gluon/validators.py", line 660, in __call__ >> if isinstance(value, (int, long)) or value.isdigit(): >> AttributeError: 'NoneType' object has no attribute 'isdigit' >> >> >> Thanks again for your help. >> >> >> >> On Fri, Jun 2, 2017 at 11:04 AM, Anthony wrote: >> >>> Can we see the code and full traceback? >>> >>> -- >>> 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 a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>> pic/web2py/Cqz5GbP07F0/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/Cqz5GbP07F0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.