Dear Massimo. My code is the following: @auth.requires_membership('Administrador') def clientes(): class Virtual(object): @virtualsettings(label=T('Editar')) def edit(self): link_editar= URL(r =request,f='editablefunction', args=[self.clientes.id]) link_icono_editar= IMG(_src=URL(r=request,c='static', f='images/Edit_Icon.png'), _alt='Editar' ) return (A(link_icono_editar,_href= link_editar))# + str(self.clientes.id))) reg=db(db.clientes).select(db.clientes.id,db.clientes.rut,db.clientes.dv,db.clientes.rsocial, db.clientes.direccion,db.clientes.ciudad,db.clientes.mail, db.clientes.tipo,db.clientes.fecha,db.clientes.giro,db.tarifa.nombre,
db.estados.nombre,db.clientes.tarifica, join=(db.tarifa.on(db.clientes.id_tarifa==db.tarifa.id), db.estados.on(db.clientes.estado==db.estados.id), db.tipos.on(db.clientes.tipo==db.tipos.id), db.tarificacion.on(db.clientes.tarifica==db.tarificacion.id)), orderby=db.clientes.rsocial)
powerTable = plugins.powerTable powerTable.datasource = reg ............. ............. table=powerTable.create() return dict(table=table) I do not understand what is wrong. --- On Sun, 9/30/12, Massimo Di Pierro <massimo....@gmail.com> wrote: |
|
|
|
|
|
|
|
|
|
|
Dear Bruno. Yes effectively i am using the new version of web2py 2.0.8 --- On Mon, 10/1/12, Bruno Rocha <rocha...@gmail.com> wrote: |
|
|
Dear Bruno Any update about powerTable + Web2py 2.0.9 |
|
Date: Monday, October 1, 2012, 1:04 AM |
|
|
<type 'exceptions.AttributeError'> 'Row' object has no attribute 'product'
Version
web2py™ (2, 0, 9, datetime.datetime(2012, 10, 2, 3, 55, 58), 'dev') Python Python 2.7.3: /usr/bin/python
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Traceback (most recent call last
):
File "/home/www-data/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 80, in <module>
File "/home/www-data/web2py/gluon/globals.py", line 186, in <lambda>
self._caller = lambda f: f()
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 25, in index
table = table.create()
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 810, in plugin_powertable
PowerTable(),
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 214, in __init__
_id = record[keycolumntbl][keycolumnfld]
File "/home/www-data/web2py/gluon/dal.py", line 6369, in __getitem__
return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 'product'
<type 'exceptions.AttributeError'> 'Row' object has no attribute 'product'
Version
web2py™ (2, 1, 0, datetime.datetime(2012, 10, 8, 15, 17, 50), 'dev') Python Python 2.7.3: /usr/bin/python
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 80, in <module
>
File "/home/www-data/web2py/gluon/globals.py", line 187, in <lambda>
self._caller = lambda f: f()
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 25, in index
table = table.create()
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 810, in plugin_powertable
PowerTable(),
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 214, in __init__
_id = record[keycolumntbl][keycolumnfld]
File "/home/www-data/web2py/gluon/dal.py", line 6376, in __getitem__
return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 'product'
and the lines that I have changed are from line no 177 to 185 as follows :
elif headers=='labels':
headers = {}
for c in columns:
(t,f) = c.split('.')
table = sqlrows.db[t]
if f in table.fields:
headers[c] = table[f].label
else:
headers[c] = virtuallabels.get(c,capitalizefieldname(c))
Function argument list
()
Code listing
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
table.showkeycolumn = False
table.extra = dict(
details={'detailscallback':URL('myfunction.load')}
)
table = table.create()
return locals()
Variables
table <Storage {'keycolumn': 'product.id', 'extra': {'...te': <function plugin_powertable at 0xa762e144>}> table.create <function plugin_powertable>
-
File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in plugin_powertable at line 811
code
arguments
variables
Function argument list
()
Code listing
806.
807.
808.
809.
810.
811.
812.
813.
814.
815.
ifunctions=str(ifunctions),
searchcolumnjs=str(searchcolumnjs)
)
),
CSS,
PowerTable(),
)
plugins.powerTable.create = plugin_powertable
Variables
global PowerTable <class '__restricted__.PowerTable'>
File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in __init__ at line 215
code
arguments
variables
Function argument list
(self=<__restricted__.PowerTable object>)
Code listing
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
else:
_title = T('Record %s' % str(rc+1))
#setting the id and key for every <tr> based on required keycolumn
try:
_id = record[keycolumntbl][keycolumnfld]
except KeyError:
if virtualfields:
_id = record[sqlrows.colnames[0].split('.')[0]].id
else:
Variables
record <Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}> _id undefined keycolumntbl 'product' keycolumnfld 'id'
-
File /home/www-data/web2py/gluon/dal.py in __getitem__ at line 6376
code
arguments
variables
Function argument list
(self=<Row {'description': 'LCD TV', 'quantity': 34,
'...ter object at 0xa757f98c>, 'name': 'Television'}>,
key='product')
Code listing
6371.
6372.
6373.
6374.
6375.
6376.
6377.
6378.
6379.
6380.
elif m:
try:
return ogetattr(self, m.group(1))[m.group(2)]
except (KeyError,AttributeError,TypeError):
key = m.group(2)
return ogetattr(self, key)
def __setitem__(self, key, value):
setattr(self, str(key), value)
Variables
self <Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}> global ogetattr <slot wrapper '__getattribute__' of 'object' objects> key 'product'
try:except KeyError:_id = record[keycolumntbl][keycolumnfld]
After a little digging around on the web I found out why I was powertable was generating errors with the latest web2py.
jquery version 1.8 requires jquery-ui-1.8.22
I went to http://jqueryui.com/ and downloaded legacy v1.8.24 which provided jquery-ui-1.8.24.custom.zip. This zip file included
jquery-ui-1.8.24.custom.min.js which I then copied to static/plugin_powertable/ui/js
I modified models/powertable.py to load it:
elif field.represent:r = field.represent(r)