I believe that with ipython it already works doing tg-admin shell
file.py. So perhaps you don't need to do anything with it code wise.

On 5/22/06, Jorge Vargas <[EMAIL PROTECTED]> wrote:
> this has been said in some way or another many times on the list, I decided
> to give it a go and provide a patch but I got stuck.... any help will be
> appreciated
>
> There is a need to run some commands in a "batch" like approach, known cases
> I remenber
> - adding inicial data to a database
> - adding default groups,user,etc to identity (an aditional fix is needed for
> this since identity doesn't works on tg-admin shell see)
> - executing some kind of cleanup (address by the new scheduler module,
> although it still needs a execute ones)
> - testing (this is no longer valid since we have nose in the projects)
>
>
> So I though why we dont do something like
> tg-admin shell batch.py
> where batch.py will have no restrictions, just plain old python code that
> will do whatever you want.
>
> poking around in
> http://trac.turbogears.org/turbogears/browser/trunk/turbogears/command/base.py
>
> I have found that all that is needed is adding to the run method in Shell
>
> if sys.argv[1]:
>     filename=sys.argv[1]
>
> and then pass filename to
> 188                     shell = IPython.Shell.IPShell(user_ns=locals)
> 192                     code.interact(local=locals)
>
>  so I'll create add
>
> console =
> InteractiveConsole(locals=locals,filename=filename)
> console.interact()
>
> at this point a couple of things stop me
>
> #1 how will I pass in normal interpreter params (for example -i will be
> helpfull here)
> #2 how to pass in a filename to IPython (i'm not an ipython user)
> #3 should I just create a new class that will extend CommandWithDB
>


-- 
cheers
    elvelind grandin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to