Thx to both of you! There is also the google code issue here: https://code.google.com/p/web2py/issues/detail?id=2006 <https://code.google.com/p/web2py/issues/detail?id=2006>
dex* > On Jan 15, 2015, at 8:48 AM, Prasad Muley <pmmu...@gmail.com> wrote: > > Hi Massimo, > > Thanks for reply. I've sent you the pull request on github. Let me > know if you get any errors :) > > > On Thu, Jan 15, 2015 at 9:26 PM, Massimo Di Pierro > <massimo.dipie...@gmail.com <mailto:massimo.dipie...@gmail.com>> wrote: > Thanks. I will merge this patch! > > > On Thursday, 15 January 2015 04:01:24 UTC-6, Prasad Muley wrote: > Hello Massimo and Dexter, > > I've a fix for this issue. I've tested it and attached the diff file. > PFA. > > Let me know if I missed anything. > > Btw Can I send pull request? > > On Saturday, October 25, 2014 at 5:17:24 AM UTC+5:30, Massimo Di Pierro wrote: > Hello Dexter, I think your are right. I will review this asap. Meanwhile, > would you be able to open an issue with a link to this thread so we can more > easily keep track. Thanks!. > > Massimo > > On Thursday, 23 October 2014 13:23:16 UTC-5, Dexter Hadley wrote: > Hi All, > > This is my first time posting a question, so thanks to Massimo and they whole > community for making web2py. Its great! > > I am trying to export results from a customized full-text search using > SQLFORM.grid. My backend is a Postgres db, and I successfully define > "search_widget" and "searchable" functions that are passed to the > SQLFORM.grid to do the full-text search. It will works pretty well on the > web app. However, once I click the export button, SQLFORM.grid apparently > recreates the query using the default SQLFORM.build_query and ignores the > correct query which I define in searchable. After poking around in > sqlhtml.py, I found this is so because the exporter only conditions on > request.vars.keywords before calling SQLFORM.build_query, and it does not > check for callable(searchable) which I think it should do. In fact, I fixed > it by editing sqlhtml.py to force the exporter to condition on > (request.vars.keywords and callable(searchable)) before setting up the rows > object to export. The code I added is in bold below (on line 2298 of > sqlhtml.py): > > if request.vars.keywords and callable(searchable): > try: > #the query should be constructed using searchable > fields but not virtual fields > sfields = reduce(lambda a, b: a + b, > [[f for f in t if f.readable and not > isinstance(f, Field.Virtual)] for t in tables]) > dbset = dbset(SQLFORM.build_query( > sfields, request.vars.get('keywords', ''))) > rows = dbset.select(left=left, orderby=orderby, > cacheable=True, > *selectable_columns) > except Exception, e: > response.flash = T('Internal Error') > rows = [] > else: > rows = dbset.select(left=left, orderby=orderby, > cacheable=True, *selectable_columns) > > Is this a bug or is there a better way to do an export of customized search > results using SQLFORM.grid? I'm using the current version of everything > (web2py 2.9.11, Postgres 9.3, Python 2.7.8). Thx again, > > dex* > > -- > Resources: > - http://web2py.com <http://web2py.com/> > - http://web2py.com/book <http://web2py.com/book> (Documentation) > - http://github.com/web2py/web2py <http://github.com/web2py/web2py> (Source > code) > - https://code.google.com/p/web2py/issues/list > <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/Td58YKBAaMo/unsubscribe > <https://groups.google.com/d/topic/web2py/Td58YKBAaMo/unsubscribe>. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com > <mailto:web2py+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > > -- > Thanks and Regards > Prasad M. Muley > > -- > Resources: > - http://web2py.com <http://web2py.com/> > - http://web2py.com/book <http://web2py.com/book> (Documentation) > - http://github.com/web2py/web2py <http://github.com/web2py/web2py> (Source > code) > - https://code.google.com/p/web2py/issues/list > <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/Td58YKBAaMo/unsubscribe > <https://groups.google.com/d/topic/web2py/Td58YKBAaMo/unsubscribe>. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com > <mailto:web2py+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.