sorry for the late reply. i am travelling and i have no access to a
development machine.
I am not familiar with this django shell handling. so i can not really
tell you whats going on without trying it out. I can tell that doit
python-actions(as you are using in your example) or command-actions
were not designed to handle interaction with users... so you are doing
something that I never and probably no one tried before.
I guess this is a valid use-case to be handled by doit.
I guess the best way to do this would be to create a new kind of
action instead of changing the existing ones to handle interaction.
the existing ones mess up with the output depending on its verbosity
and they need to save the output.
it is not documented but the actions parameter from a task can take
instances of sub-classes from BaseAction. So you can just add this
code to the top of your dodo.py file, and you wont need to modify doit
source-cede.
Please note that i am not sure this approach will work! try at your
own risk... It would be something like this:
from doit.actions import BaseAction
class InteractiveAction(BaseAction):
# check: http://bazaar.launchpad.net/~schettino72/doit/trunk/view/head:/doit/action.py
# in short you just need to implement the execute method. and include
instance attributes out,err, result, values. you can leave the
attributes with default values. i guess for interactive action this
wont matter.
def __init__(self, action, task=None):
self.action = action
self.task = task
self.out = None
self.err = None
self.result = None
self.values = {}
def execute(self, out=None, err=None):
# this I will leave to you implement :)
---------------------
and on your task you would change this:
- 'actions': [django_command],
+ 'actions': [InteractiveAction(django_command)],
if it works ok. we can add this InteractiveAction in the next doit release.
cheers,
Eduardo