[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread szimszon
Okay. I see. Than it will be good just to forbid args and vars field to have a not valid json string. In 1.99.2 I can set args and vars to arbitrary string witch cause exception in scheduler. So we need a json validator to try to .loads() the string and if it fails abort the insertion... If we

[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread Massimo Di Pierro
Suppose the use types "{'x':True}" instead of true. Loads will fail. Dump will succeed but it will serialize it as string not as dictionary. Logically what you ask cannot be done. The text field requires JSON. We validate Json. If the json is invalid we cannot "deserialize it" before json.dumping a

[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread szimszon
Try to .loads() it and if it failed try to .dumps() and store it in db.

[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread Massimo Di Pierro
How would it detect it is not in json? You have to type in a string that contains strings, list, dicts, dates, etc. How would you type it in in a form if not in json? On Oct 25, 7:49 am, szimszon wrote: > What if the scheduler_task table's args field get a validator and the > validator try to mak

[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread Massimo Di Pierro
The scheduler wants args and vars in json because they must be stored in db. On Oct 25, 3:42 am, szimszon wrote: > If I make a scheduler task from web2py I have to do something like: > >     import uuid >     uuid_str = str( uuid.uuid4() ) >     *import simplejson* >     db.scheduler_task.insert(

[web2py] Re: Scheduler and passing argument or var

2011-10-25 Thread szimszon
What if the scheduler_task table's args field get a validator and the validator try to make a json string from a variable passed to args= if it's not already json? It could feel more web2py... :-o