On Thursday 21 May 2009 08:22:24 Jorge Vargas wrote:
> On Mon, May 18, 2009 at 6:55 AM, Diez B. Roggisch <[email protected]> wrote:
> > Hi,
> >
> > is there a way to obtain a reference to the root-controller-object so
> > that I can attach a hierarchy of test-only controllers to it?
> >
> > This is TG2 of course.
>
> I don't know but I'll sure love to know if you find out.
I finally did.
Assuming the paster-stuff is bootstrapped through code like
here_dir = os.path.dirname(os.path.abspath(ableton.__file__))
conf_dir = os.path.dirname(here_dir)
wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
you then can do it simply like this (inside a function/method!!)
import myproject.controllers.root as root
root.RootController.mountpoint = TestController()
Then you can access the controller through the usual
self.app.get("/mountpoint/action")
Of course mounting of whole controller hierarchies is perfectly fine.
So I create a function in our base-test-class that allows to register a passed
controller for a given mountpoint. Voila, greatness ensues.
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---