After looking for a bit this morning, I can say that, under the
current setup, this can't be done using pure TG code.

TG uses the function engine_from_config which reads from the config
file and configures SA from there. After reading the SA code, the
engine_from_config does not look for a proxy class at all. Now, TG
could be modified to allow this, but (honestly) this will be a low
priority item to get done by us. A patch would be happily accepted,
and is the only likely way to get TG supporting this in the near
future. Even then, it will only be in the development branch, which is
likely to take a while before we even cut an alpha of the next
release.

A patch will work, but likely leave you frustrated. The best choice
that I can provide is going to be to modify your nosetests. You can
define package level setup and teardown functions for nose. I would
add a setup that stores the current values of metadata.engine (from
your existing myapp/model/__init__.py), and then replaces it with a
new engine that you define. The new engine can be built using
engine_from_config in the exact same way that TG does. Since your code
is calling it, though, you can add in the proxy keyword argument, and
get what you are looking to get.

Don't forget to set the teardown method to restore the old
metadata.engine, though. You'll need that elsewhere.

I hope that helps.

On Fri, Jan 28, 2011 at 3:09 PM, NiL <[email protected]> wrote:
> Hi
>
> after some more research, I feel that my setup where I declare my
> proxy isn't properly used
>
> the default TestController for functionnal app looks like this
>
>
>    def setUp(self):
>        """Method called by nose before running each test"""
>        # Loading the application:
>        conf_dir = config.here
>        wsgiapp = loadapp('config:test.ini#%s' %
> self.application_under_test,
>                          relative_to=conf_dir)
>        self.app = TestApp(wsgiapp)
>        # Setting it up:
>        test_file = path.join(conf_dir, 'test.ini')
>        cmd = SetupCommand('setup-app')
>        cmd.run([test_file])
>
>
> so I rephrase my question, how can I setUp this testcontroller with a
> proxied engine ?
>
> best
> NiL
>
> --
> 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.
>
>



-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

-- 
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