--
You received this message because you are subscribed to the Google Groups "python-doit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Arman
I have created study on how can be the parametrization done by means of TaskContext class.
See my repository https://github.com/vlcinsky/doit-task-context-study
Jan
Hi Jan,
ok, I look into passing the info as arguments and here is the "ugliness" (as Eduardo pointed out) of the solution. Say, we have multiple 'actions' on the same task, we have repeated pass the same arguments into each function. That makes it a but hard to manage the dodo file.
It will work, but it ain't pretty. :)
I thought I should share this with you.
Thanks,-Arman.
On Thu, Aug 31, 2017 at 9:25 PM Arman Ohanian <arman....@gmail.com> wrote:
Ok, I see your point.
I will give it a try.
Thank you.
On Thu, Aug 31, 2017, 5:03 PM Jan Vlčinský (gmail) <jan.vl...@gmail.com> wrote:
Hi Arman
Passing a dictionary into task (resp. action of a task, there can be multiple actions in one task) really allows complex logic.
You have to decide somewhere in the code, what action shall use which value from the dictionary.
You already can do that by means of calling python functions as action and passing it arguments and keywords.
Adding extra keyword to returned/yielded dictionary does not improve the solution, in fact it adds extra complexity.
My example with string substitution was just an example, a task (this time command line call) can get some parameter. I had better to provide an example with calling a python function. Tutorial provides such examples.
Jan
On 31.8.2017 23:12, Arman Ohanian wrote:
Thanks Jan.
I don't see how it's the same thing.
Passing a dictionary allows me to implement complex logic in the function.If I understand it correctly, you are suggesting using string substitution?
On Thu, Aug 31, 2017 at 12:56 PM Jan Vlčinský (gmail) <jan.vl...@gmail.com> wrote:
In short: "Luke, use the power" (you already have).
One of beauties of doit is it allows using full power of python code.
You are free to define the attributes in the code above returning (or yielding) the "plan" dictionary as shown below.
With best regards
Jan Vlčinský
I will take a closer look when I get a chance.
Huge thanks for making the effort.
-Arman.