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"
<http://127.0.0.1:8000/admin/default/edit/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"
<http://127.0.0.1:8000/admin/default/edit/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

On Mon, Jul 25, 2016 at 2:07 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you show the full traceback?
>
>
> On Thursday, 21 July 2016 15:53:04 UTC-5, Richard wrote:
>>
>> Did we open a ticket and solve this one... I think I have this issue... I
>> try to create an archive table and I fall on this error
>>
>> dal/pydal/adapters/postgres.py", line 181, in lastrowid
>>
>>     return int(self.cursor.fetchone()[0])
>>
>>
>> I can't figure out why so far...
>>
>> Richard
>>
>> On Wed, Aug 6, 2014 at 2:48 PM, Niphlod <niph...@gmail.com> wrote:
>>
>>> not really (scouting through code and docs seems that we're using only
>>> for postgresql something that isn't that "stable" when triggers are
>>> involved), but it's anyway fixable.
>>>
>>>
>>> On Wednesday, August 6, 2014 8:24:24 PM UTC+2, Leonel Câmara wrote:
>>>>
>>>> I don't think this "bug" is just in PostgreSQL. For instance MSSQL
>>>> should probably use OUTPUT INSERTED.ID to get the id and Oracle can
>>>> use RETURNING like PostgreSQL too.
>>>>
>>>> Basically any kind of lastval variant can be problematic.
>>>>
>>>>
>>>>
>>> --
>>> 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.
>>>
>>
>> --
> 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.
>

-- 
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.

Reply via email to