Hi I'm new to Web2py and having some trouble with update_or_insert. Hope you guys can help me. The first time I run the update_or_insert function it correctly inserts the values into the table. (I'm using sqlite but also tried Postgresql). The next time I run it I get an Attribute: Traceback (most recent call last): File "C:\...\gluon\restricted.py", line 227, in restricted exec ccode in environment File "C:/.../applications/pant/controllers/test.py", line 6, in <module> File "C:\...\gluon\globals.py", line 417, in <lambda> self._caller = lambda f: f() File "C:/.../applications/pant/controllers/test.py", line 4, in index db.stillingar.update_or_insert( (db.stillingar.notandi==1)&(db. stillingar.stilling=='setting1'), notandi=1 , gildi="111", stilling= "setting1") File "C:\...\gluon\packages\dal\pydal\objects.py", line 786, in update_or_insert record.update_record(**values) File "C:\...\gluon\packages\dal\pydal\objects.py", line 90, in __getattr__ raise AttributeError AttributeError
My table definition is: db.define_table('stillingar', Field('notandi', type="integer", required=True), Field('stilling', type="text", required=True), Field('gildi', type="text"), primarykey=['notandi', 'stilling'], migrate=True) My controller is: # -*- coding: utf-8 -*- def index(): db.stillingar.update_or_insert( (db.stillingar.notandi==1)&(db. stillingar.stilling=='setting1'), notandi=1 , gildi="111", stilling= "setting1") return dict() My view is basic. Can you guys tell me what I'm doing wrong? -- 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.