I'm bumping this message, because the bug still hasn't been fixed in the new release.
The erroneous line is now line 822 in dal.py, version 1.96.1. It worked correctly after I applied the same fix. On Apr 29, 12:30 pm, Loren McGinnis <mcginnis.lo...@gmail.com> wrote: > I'm using a legacy database that has a table with multiple columns in > the primary key (If I could, I would change it). > > When inserting into this table, I get the following error: > > File "/home/loren/dev/web2py/gluon/dal.py", line 774, in insert > return dict( [ (k,fields[k]) for k in table._primarykey ]) > TypeError: list indices must be integers, not str > > Some context for this line, in dal.py: > > except Exception, e: > if isinstance(e,self.integrity_error_class()): > return None > raise e > if hasattr(table,'_primarykey'): > return dict( [ (k,fields[k]) for k in table._primarykey ]) > > id = self.lastrowid(table) > if not isinstance(id,int): > return id > rid = Reference(id) > > I was able to fix this by simply replacing the line with: > > return dict([(k[0].name, k[1]) for k in fields if k[0].name in > table._primarykey])