Traceback (most recent call last):
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/richard/Documents/programmation/version_2146/web2py/applications/sgddms/controllers/test.py", line 3883, in <module>
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/tools.py", line 4241, in f
return action(*a, **b)
File "/home/richard/Documents/programmation/version_2146/web2py/applications/sgddms/controllers/test.py", line 766, in update
form.process(detect_record_change=True)
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/html.py", line 2298, in process
self.validate(**kwargs)
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/html.py", line 2236, in validate
if self.accepts(**kwargs):
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/sqlhtml.py", line 1744, in accepts
self.id_field_name]).update(**fields)
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/objects.py", line 2049, in update
if any(f(self, update_fields) for f in table._before_update):
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/objects.py", line 2049, in <genexpr>
if any(f(self, update_fields) for f in table._before_update):
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/objects.py", line 390, in <lambda>
archive_record(qset, fs, db[an], cn))
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/helpers/methods.py", line 97, in archive_record
archive_table.insert(**fields)
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/objects.py", line 726, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/adapters/base.py", line 751, in insert
id = self.lastrowid(table)
File "/home/richard/Documents/programmation/version_2146/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 181, in lastrowid
return int(self.cursor.fetchone()[0])
TypeError: int() argument must be a string or a number, not 'NoneType'
The only thing I change, is that I activate record versioning over a table in my system... I guess that since there is detect_record_change=True, there is more than only one callback that happen and it cause the versioning callback to failed because of "lastrowid". So I guess the solution is to use RETURNING as suggest by Dragan and Lionel...
Richard