Yes, I read it.. If you try to save it on a session var (to pass between requests) it will return a pickling error (or not), depending on the query. I tried to save this db.equipment.sn_counter_id == request.args[0] and it returns a pickling error. Probably because of request.args[0].
quarta-feira, 1 de Maio de 2019 às 22:43:06 UTC+1, Dave S escreveu: > > < > > On Wednesday, May 1, 2019 at 2:22:11 PM UTC-7, [email protected] wrote: >> >> What do you mean? >> >> I don't want to serialize the query. >> And I want the query to only be executed on the desalination controller. >> >> > Did you read the reference? > > <quote> > > You can even build a query (using operators like ==, !=, <, >, <=, >=, > like, belongs) and store the query in a variable q such as in: > > >>> q = name == 'Alex' > > </quote> > > > > >> >> quarta-feira, 1 de Maio de 2019 às 22:00:27 UTC+1, Dave S escreveu: >>> >>> >>> >>> On Wednesday, May 1, 2019 at 1:53:25 PM UTC-7, [email protected] wrote: >>>> >>>> Got the answer in the Telegram chat. Using eval. >>>> It's a dangerous solution but works. >>>> >>>> >>> What about storing a querey, as in >>> <URL: >>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Query-Set-Rows >>> > >>> ? >>> >>> /dps >>> >>> >>>> >>>> quarta-feira, 1 de Maio de 2019 às 10:07:45 UTC+1, [email protected] >>>> escreveu: >>>>> >>>>> Hello, >>>>> >>>>> How to pass a query set string or a string with a select/count to be >>>>> executed in another controller? >>>>> >>>>> On one controller I create one of these 4 examples: >>>>> session.checks = [ >>>>> 'db(db.equipment.sn_counter_id == request.args[0]).count()', >>>>> T('Cannot be deleted while assigned to an equipment.'), >>>>> ] >>>>> >>>>> session.checks = [ >>>>> QUERY_FOR_COUNT, >>>>> 'db.equipment.sn_counter_id == request.args[0]', >>>>> T('Cannot be deleted while assigned to an equipment.'), >>>>> ] >>>>> >>>>> session.checks = [ >>>>> 'db(db.equipment.depends_on == request.args[0]).select()', >>>>> T('Cannot be deleted while dependent on an option.'), >>>>> ] >>>>> >>>>> session.checks = [ >>>>> QUERY_FOR_SELECT, >>>>> 'db.equipment.depends_on == request.args[0]', >>>>> T('Cannot be deleted while dependent on an option.'), >>>>> ] >>>>> >>>>> and then execute it on another controller using something similar to >>>>> (of course my example below doesn't work): >>>>> if session.checks[0]: >>>>> session.flash = session.checks[1] >>>>> redirect(return_to) >>>>> >>>>> Thanks, >>>>> >>>>> JM >>>>> >>>> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

