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.'),
]
if session.checks[0]:
session.flash = session.checks[1]
redirect(return_to)
Got the answer in the Telegram chat. Using eval.It's a dangerous solution but works.
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.
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>
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 thisdb.equipment.sn_counter_id == request.args[0]and it returns a pickling error.Probably because of request.args[0].
Can't do that. As I told you the query has to be executed on the destination.
Got the answer in the Telegram chat. Using eval.It's a dangerous solution but works.
from mymodule import shared_function
rows = shared_function(pass, some, args)