On 9/12/07, Ben Bangert <[EMAIL PROTECTED]> wrote: > > On Sep 11, 2007, at 10:54 PM, Max Ischenko wrote: > > > > > > > I wonder if this _current_obj thingy is documented somewhere. > > I see, this is just an instance of > http://pythonpaste.org/class-paste.wsgiwrappers.WSGIRequest.html > > The Pylons globals (c, g, session, request, response) are all object proxies > that actually relay all access to the real objects. This is to ensure thread > safety and request safety in your application. Using '_current_obj()' > retrieves the real object they're proxying to.
The proxying is mostly transparent but certain operations like dir() I think refer to the proxy rather than the proxied object. At which time you have to have memorized the ._current_obj() trick. There are also similar proxy objects like in SQLAlchemy that have a different method name for the same thing (something like. currentObj()), so you have to memorize that too. It's a bit of a hassle. Maybe we should have a standalone proxying library that all these objects from different projects could use. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
