>>> db.uperson.insert(auth_user=1,age=100,country='fr')
1L
>>> db.commit()
>>> r = db.uperson.validate_and_update(db.uperson.auth_user==1,age=101)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 741, in validate_and_update
response, new_fields = self._validate_fields(fields, 'update')
File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 727, in _validate_fields
value, error = self[fieldname].validate(raw_value)
File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 1625, in validate
(value, error) = validator(value)
File "/opt/web2py/gluon/validators.py", line 696, in __call__
row = subset.select(table._id, field, limitby=(0, 1), orderby_on_limitby=False).first()
File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 2002, in select
return adapter.select(self.query,fields,attributes)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", line 122, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1273, in select
sql = self._select(query, fields, attributes)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1160, in _select
sql_w = ' WHERE ' + self.expand(query) if query else ''
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 945, in expand
rv = op(first, second, **optional_args)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 839, in EQ
self.expand(second, first.type))
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 955, in expand
rv = self.represent(expression, field_type)
File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1432, in represent
return str(long(obj))
ValueError: invalid literal for long() with base 10: 'None'
second attempt:
>>> db.uperson.validate_and_update(db.uperson.auth_user==1,auth_user=1,age=102)
<Row {'errors': {'auth_user': 'Value already in database or empty'}, 'id': None}