Issue #5 new

Plugin model AttributeError accessing id field

Alan Etkin
created an issue

The followint controller:

def showtable():
    return dict(load=LOAD(f="atable.load", ajax=True, times="infinity", timeout=30000))

def atable():
    reg=db(db.auth_user).select()
    powerTable.datasource=reg
    table=powerTable.create()
    return dict(table=table)

Raises this exception in PowerTable plugin:

Traceback (most recent call last):
  File "/home/spametki/web2py/web2py-hg/gluon/restricted.py", line 212, in restricted
    exec ccode in environment
  File "/home/spametki/web2py/web2py-hg/applications/pt/controllers/default.py", line 86, in <module>
  File "/home/spametki/web2py/web2py-hg/gluon/globals.py", line 193, in <lambda>
    self._caller = lambda f: f()
  File "/home/spametki/web2py/web2py-hg/applications/pt/controllers/default.py", line 83, in atable
    table=powerTable.create()
  File "/home/spametki/web2py/web2py-hg/applications/pt/models/plugin_powertable.py", line 817, in plugin_powertable
    PowerTable(),
  File "/home/spametki/web2py/web2py-hg/applications/pt/models/plugin_powertable.py", line 215, in __init__
    _id = record[keycolumntbl][keycolumnfld]
  File "/home/spametki/web2py/web2py-hg/gluon/dal.py", line 6451, in __getitem__
    return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 'auth_user'

I managed to fix it with this change at line 213 of the plugin model file plugin_powertable.py. Attached is a diff with the fix

Comments (1)

  1. Log in to comment