SQLFORM.grid search type error reduce()

43 views
Skip to first unread message

Paul Ellis

unread,
Aug 1, 2017, 4:46:13 AM8/1/17
to web2py-users
I am getting this error only when searching the auth_membership table

I have put in a basic 'appadmin' in my webapp. I call it 'tooladmin' to differentiate from the built in stuff.

I use this function to edit any database table:
def manage_table():
    tablename = request.args(0)
    pagetitle = H4('{0} {1}'.format(T('Manage'), tablename))
    buttongroup = [_btn_index()]
    table = db[tablename]
    pagecontent = SQLFORM.grid(table, args=[request.args(0)])


    response.view = 'tooladmin_core.html'
    return dict(pagetitle=pagetitle, buttongroup=buttongroup, pagecontent=pagecontent)

The search feature on the SQLFORM.grid is throwing this error when searching the auth_membership table:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Traceback (most recent call last):
File "E:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
File "E:/web2py/applications/OfferTool/controllers/tooladmin.py", line 262, in <module>
File "E:\web2py\gluon\globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "E:/web2py/applications/OfferTool/controllers/tooladmin.py", line 136, in manage_table
pagecontent = SQLFORM.grid(table, args=[request.args(0)])
File "E:\web2py\gluon\sqlhtml.py", line 2526, in grid
subquery = SQLFORM.build_query(sfields, keywords)
File "E:\web2py\gluon\sqlhtml.py", line 1827, in build_query
) for k in key.split()])
TypeError: reduce() of empty sequence with no initial value


Massimo Di Pierro

unread,
Aug 4, 2017, 10:58:29 AM8/4/17
to web2py-users
Just fixed in trunk. Can you please help test the fix?

Paul Ellis

unread,
Aug 7, 2017, 7:40:56 AM8/7/17
to web2py-users
I will gladly test. But I can't do it until next week.

Sent from TypeApp
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/UnN6AyOh2Lg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Ellis

unread,
Aug 15, 2017, 7:27:42 PM8/15/17
to web2py-users
ok no more errors.

If I search for a name (John) for example in the table i get everything, Or for his ID (11) I get everything.

I realise this is a join table (Many to Many) so it's no big deal but the search here is not very useful.

I will need to implement special grids for these situations.

Thanks for the fix.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/UnN6AyOh2Lg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages