Turbogears and interaction with a CLI

View: New views
4 Messages — Rating Filter:   Alert me  

Turbogears and interaction with a CLI

by Bugzilla from briner@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

I'd like to have an TG project which could have also a CLI at the same
time. Is there a possibilities to split the Controller so that we can
use through the web and through a CLI ?

Regards

cED
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Turbogears and interaction with a CLI

by Diez B. Roggisch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Monday 02 November 2009 13:33:59 yuhl wrote:
> Hello,
>
> I'd like to have an TG project which could have also a CLI at the same
> time. Is there a possibilities to split the Controller so that we can
> use through the web and through a CLI ?

You don't say which TG version you are planning to use, so we can't be more
specific. Some general remarks:

 - it is possible to use model and utility code outside of TG, there are
recipes how to do that.

 - your can *not* use controllers in a CLI (or at least not useful, and not
without major performance drawbacks). You can't even easily import from them.

Instead, arrange your project so that you have model and utility or business
logic code in separate modules, and both controllers and your CLI app fetch
from those.

Then it's perfectly fine, we have similar setups without a hitch.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Turbogears and interaction with a CLI

by Bugzilla from briner@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello
> > Hello,
>
> > I'd like to have an TG project which could have also a CLI at the same
> > time. Is there a possibilities to split the Controller so that we can
> > use through the web and through a CLI ?
>
> You don't say which TG version you are planning to use, so we can't be more
> specific. Some general remarks:
Not a specific TG version, but I'm open to use the best one.

>  - it is possible to use model and utility code outside of TG, there are
> recipes how to do that.
>
>  - your can *not* use controllers in a CLI (or at least not useful, and not
> without major performance drawbacks). You can't even easily import from them.
not import it... so this is a major drawbacks!

> Instead, arrange your project so that you have model and utility or business
> logic code in separate modules, and both controllers and your CLI app fetch
> from those.
okay, So if I understand well, I'll have to split my code. I'll have a
main module dealing with the logic, and having to module on top of it
(CLI and TG) which will import this submodule.

 What to you mean by fetch ?? Is this a specific terminology ?

> Then it's perfectly fine, we have similar setups without a hitch.
good

Thanks for your help
> Diez
cED
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Turbogears and interaction with a CLI

by Diez B. Roggisch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Not a specific TG version, but I'm open to use the best one.

TG2 and TG1 both work great, I personally would suggest TG2 for a new project
though.

>
> >  - it is possible to use model and utility code outside of TG, there are
> > recipes how to do that.
> >
> >  - your can *not* use controllers in a CLI (or at least not useful, and
> > not without major performance drawbacks). You can't even easily import
> > from them.
>
> not import it... so this is a major drawbacks!

Not really. Your controller-classes should be about presentation logic you
don't need in the CLI.

>
> > Instead, arrange your project so that you have model and utility or
> > business logic code in separate modules, and both controllers and your
> > CLI app fetch from those.
>
> okay, So if I understand well, I'll have to split my code. I'll have a
> main module dealing with the logic, and having to module on top of it
> (CLI and TG) which will import this submodule.
>
>  What to you mean by fetch ?? Is this a specific terminology ?

No, just translate fetch to import.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---