[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Constantine Vasil
in deferred I don't have a direct access to *request.** *Usually I use request = current.request, that is why I need an access to 'current'. But this is a no go. So I have to provide the path to web2py for deferred somehow. import os from gluon.settings import global_settings web2py_path = os.p

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Constantine Vasil
And here is why GAE loses the path (sometimes) http://code.google.com/p/googleappengine/issues/detail?id=772#c11 All, this is now an officially acknowledged bug. The cause is a "feature" which resets sys.path to a fixed default at the start of each request. Due to where we are in the QA cycle

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Constantine Vasil
Here is how Google described it: http://code.google.com/appengine/articles/deferred.html Handling import path manipulation Some applications, or the frameworks they use, rely on manipulating the Python import path in order to make all the libraries they need available. While this is a perfectly

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Anthony
Would os.path.abspath(request.folder) work as well? It works on Windows (actually, request.folder itself appears to be the absolute path on Windows). Anthony On Tuesday, December 13, 2011 2:04:09 PM UTC-5, Ross Peoples wrote: > > I've never used GAE before, but you would normally get the absolu

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Ross Peoples
I've never used GAE before, but you would normally get the absolute path to web2py using something like this: import os from gluon.settings import global_settings web2py_path = os.path.join(global_settings.applications_parent, request.folder) Hope that helps.

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Constantine Vasil
It is related to deferred.defer in GAE: https://groups.google.com/forum/#!topic/web2py/Fp7B477Db8c I made it work but I am using 'current' object to get request/response/mail. It works but sometimes does not. It seems deferred library loses the path of web2py sometimes. I am investigating how to

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Ross Peoples
I don't think you can because "current" is a threaded object. It contains 3 things: request, response, session. You could probably serialize much of the data contained in those three objects, however, this will be difficult because they contain functions. Web2py does a lot of this when it genera

[web2py] Re: How to save the 'current' object to database?

2011-12-13 Thread Constantine Vasil
or how to serialize it?