Pearl wrote: > > I want to use multiple controllers in my project. Unfortunately I > couldn't find any documents stating the preferred way in turbogears. > > At present I have done multiple controllers in the following way. > Controllers are as follows: all inherits from controllers.Root. (I > have used TurboGears 0.8)[...] > > Is this the right way of doing this? How can I make it proper?
Create new controllers that way:
from turbogears import controllers, expose, ...
class ImageController(controllers.Controller):
@expose(...)
def create(self, ...):
...
Then, have an instance of it as member variable in your root controller, i.e.:
class Root(controllers.RootController):
images = ImageController()
...
Now you can access the very first class' method create via /images/create.
Controllers can contain other controllers. That way you can build hierarchies.
Please see: http://docs.turbogears.org/1.0/GettingStarted/CherryPy
-- W-Mark Kubacki
smime.p7s
Description: S/MIME Cryptographic Signature

