Mark and Antii,

Thank you both for the help and guidance, that was the key, adding the
@expose decorator to my controller. Because TG2 is based on Pylons I
was following the Pylons google hits to add a new controller to my
project. Can you say "D'OH!!" That solves a problem so I will plunge
ahead and see what else I run into.

Again, thanks!
Doug

On Nov 14, 11:53 pm, "Mark Ramm" <[EMAIL PROTECTED]> wrote:
> To add a new controller, just add a class in root.py or add it in
> another module and import it into root.py.
>
> You do need to @expose anything you want to be exposed to the web, and
> you don't need to create a controller via paster controller unless
> you're doing pylons style controllers with routes.
>
> If you're doing normal controllers, you can follow the instructios in
> the wiki here:
>
> http://turbogears.org/2.0/docs/main/Controllers.html#subcontrollers-a...
>
>
>
> On Fri, Nov 14, 2008 at 8:57 PM, writeson <[EMAIL PROTECTED]> wrote:
>
> > Antti,
>
> > I'm not sure I know what you mean by "tried with the paster crud
> > command". But, I will try adding the @expose decorator over the index
> > method in the StatusController class.
>
> > Doug
>
> > On Nov 15, 8:26 am, Antti Niinikoski <[EMAIL PROTECTED]>
> > wrote:
> >> Hmm.. have you tried with the paster crud command? I tried quickly
> >> with the paster controller and it is more like pylons controller (as
> >> it probably suppose to be). Expose (before the index method) is
> >> missing in the new subcontroller.
>
> >> Antti
>
> >> On 15 marras, 01:54, writeson <[EMAIL PROTECTED]> wrote:
>
> >> > Hi Antti,
>
> >> > Thanks for the response. Yeah, I tried this before my initial post,
> >> > and tried it again based on your response just to be sure, but this
> >> > doesn't seem to work. Here is my RootController code:
>
> >> > from status import StatusController
>
> >> > class RootController(BaseController):
> >> >     secc = Secc()
>
> >> >     status = StatusController()
>
> >> >     @expose('srs.templates.index')
> >> >     def index(self):
> >> >         return dict(page='index', title="SRS Tools")
>
> >> > Where status is my real class (as opposed to the "something" of my
> >> > initial post). I've tried debugging this in Wing, but my status.py
> >> > module doesn't even get compiled to a status.pyc file, so things
> >> > aren't getting connected somehow.
>
> >> > Thanks for your help though, very much appreciated!!
> >> > Doug
>
> >> > On Nov 14, 6:39 pm, Antti Niinikoski <[EMAIL PROTECTED]>
> >> > wrote:
>
> >> > > Hi Doug,
>
> >> > > You can add your "something" controller to your root controller like
> >> > > this:
>
> >> > > from something import SomethingController  #import your controller
>
> >> > > class RootController(BaseController):
> >> > >          ...
> >> > >      #other controllers here
> >> > >      something = SomethingController()   #<-- makes your controller
> >> > > appear
> >> > >          ...
> >> > >      # and then methods
>
> >> > > Then you should be able to see the index method of SomethingController
> >> > > athttp://mysite.com/something
>
> >> > > Other methods of the something controller can be reached with
> >> > > something like this:
>
> >> > >http://mysite.com/something/other_method
>
> >> > > Antti
>
> >> > > On 15 marras, 00:23, writeson <[EMAIL PROTECTED]> wrote:
>
> >> > > > Hi all,
>
> >> > > > I've installed Turbogears 1.9.7 in a virtualenv on our Linux
> >> > > > development machine and have been experimenting with it. One thing 
> >> > > > I'm
> >> > > > stumped about is adding a new controller. When I do this:
>
> >> > > > paster controller something
>
> >> > > > It creates a new controller called something.py in my controllers
> >> > > > directory. But after that I'm confused. When I try to navigate 
> >> > > > tohttp://mysite.com/somethingIgeta404error. I've done some googling
> >> > > > around and everything I see confuses me more. The hits talk about
> >> > > > adding a map... item to config/routes.py, but I have no routes.py in
> >> > > > my project. They also talk about doing something similar (and a lot
> >> > > > more) in config/environment.py. Can anyone direct me to the right
> >> > > > thing to do to make new controllers active in a TG2 project?
>
> >> > > > Thanks!
> >> > > > Doug
>
> --
> Mark Ramm-Christensen
> email: mark at compoundthinking dot com
> blog:www.compoundthinking.com/blog
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to