Have you changed the structure of the table being archived?
I have had instances in the past where I have added an extra field to my 
table and all works OK until I change a record. At that point, archiving 
fails because there is now a mismatch between the structure of the table 
and the corresponding archive_table. In this case, adding the same new 
field to the archive_table solves the issue.

Andy

On Monday, February 11, 2019 at 6:02:40 PM UTC+3, Ben Lawrence wrote:
>
> Hi
> Using Python 3.7, anyone has Record Versioning working ok?  Using 
> POSTGRESQL, error is there.
>
> http://www.web2py.com/books/default/chapter/29/09/access-control?search=versioning#Record-versioning
> Whenever I change a record under versioning, say with SQLFORM.grid(), I 
> will get a key error 'id'
> thanks for your time,
> Ben
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> File "/home/www-data/web2py/applications/timecard/controllers/admin.py" 
> <https://10.1.10.147/admin/edit/timecard/controllers/admin.py>, line 154, 
> in <module>
> File "/home/www-data/web2py/gluon/globals.py", line 421, in <lambda>
> self._caller = lambda f: f()
> File "/home/www-data/web2py/gluon/tools.py", line 3867, in f
> return action(*a, **b)
> File "/home/www-data/web2py/applications/timecard/controllers/admin.py" 
> <https://10.1.10.147/admin/edit/timecard/controllers/admin.py>, line 18, 
> in co_accounts
> ,showbuttontext = False)
> File "/home/www-data/web2py/gluon/sqlhtml.py", line 2594, in grid
> next=referrer)
> File "/home/www-data/web2py/gluon/html.py", line 2302, in process
> self.validate(**kwargs)
> File "/home/www-data/web2py/gluon/html.py", line 2240, in validate
> if self.accepts(**kwargs):
> File "/home/www-data/web2py/gluon/sqlhtml.py", line 1973, in accepts
> self.id_field_name]).update(**fields)
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
> 2312, in update
> if any(f(self, row) for f in table._before_update):
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
> 2312, in <genexpr>
> if any(f(self, row) for f in table._before_update):
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
> 433, in <lambda>
> archive_record(qset, fs, db[an], cn))
> File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py", 
> line 132, in archive_record
> if fields[k] != v:
> KeyError: 'id'
>
>
>

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