Reputation: 555
Possible bug when searching in SQLFORM.grid with order activated.
To reproduce:
Traceback (most recent call last):
File "C:\Users\User\Desktop\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment)
File "C:/Users/User/Desktop/web2py/applications/bsmOnline/controllers/library.py", line 113, in <module>
File "C:\Users\User\Desktop\web2py\gluon\globals.py", line 430, in <lambda>
self._caller = lambda f: f()
File "C:/Users/User/Desktop/web2py/applications/bsmOnline/controllers/library.py", line 56, in region
create=can_add_library, editable=can_edit_library, deletable=can_delete_library)
File "C:\Users\User\Desktop\web2py\gluon\tools.py", line 3951, in f
return action(*a, **b)
File "C:/Users/User/Desktop/web2py/applications/bsmOnline/models/db1.py", line 78, in library
grid = SQLFORM.grid(query, maxtextlength=80, csv=False, **kwargs)
File "C:\Users\User\Desktop\web2py\gluon\sqlhtml.py", line 2804, in grid
otablename, ofieldname = order.split('~')[-1].split('.', 1)
AttributeError: 'list' object has no attribute 'split'
Upon clicking the 'search' button, it seems that the 'order' in request .vars is transformed from string to list, such that order = 'anykey' becomes 'order = ['anykey', 'anykey'], hence, the error.
Workaround for me:
if request.vars:
if 'order' in request.vars:
request.vars.order = request.vars.order[0]
Can somebody please confirm or am I doing something wrong?
Upvotes: 0
Views: 36