Hey I have a db table that has a self referencing field. I need to create an audit table that inherits this table. In this table I also set primarykey so that web2py does not create it's default id. Attempting to do this with the current dal.py results in a splitting error on line 523:
rtablename,rfieldname = referenced.split('.') To stop this issue I catch when the reference contains do . and isn't referring to the tablename. if (referenced.split('.')[0] == referenced) and not(referenced == tablename) and hasattr(table,'_primarykey'): ftype = self.types['integer'] This if gets added after line 520 and the lines 521 - 511 are contained in the else of this if. Another thing I thought would be nice is if you have a self referencing field in addition to 'reference tablename' you could do 'reference'. This would help in inheritance that way the table that inherits this will also have a self referencing field. To do this I modify line 520 to: referenced = field.type[10:].strip() or tablename Let me know what you guys think of these changes I would love to get them into the trunk. -Eric