On Fri, Aug 2, 2013 at 10:44 AM, Rob <[email protected]> wrote:
> > I'm having trouble understanding how I can get access to the tg cache and > I'm getting a `TypeError No object (name: cache)` -- I'm tied to TG v2.2 > for the time being... > > As stated in my previous email the TurboGears context is not available outside of the turbogears application. As your middleware is wrapping around the application is called before the application, and so the context is not available. The context includes the cache, so tg.cache is not available inside a middleware. WSGI middleware should not make the assumption that they are running inside TG as they are actually running before TG. If you really need to use tg.* objects you are limited to using controller_wrappers which are available also in 2.2. Look at http://turbogears.readthedocs.org/en/development/reference/reference.html#tg.configuration.AppConfig.register_hookif you want to see an example. Otherwise you are bound to environ['beaker.cache'] which is plain WSGI and doesn't require any TG feature. -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/groups/opt_out.

