fixed lot of problem with nodb
bzr revid: nicolas.vanhoren@openerp.com-20130613112027-1fps4v7h6zx5omo0
This commit is contained in:
parent
50a5a612da
commit
1c0282d09d
|
@ -881,7 +881,10 @@ class Session(openerpweb.Controller):
|
|||
}
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
@nodb
|
||||
def get_session_info(self):
|
||||
req.uid = req.session._uid
|
||||
req.db = req.session._db
|
||||
return self.session_info()
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
|
@ -1382,6 +1385,7 @@ class Binary(openerpweb.Controller):
|
|||
return out % (simplejson.dumps(callback), simplejson.dumps(args))
|
||||
|
||||
@openerpweb.httprequest
|
||||
@nodb
|
||||
def company_logo(self, dbname=None):
|
||||
# TODO add etag, refactor to use /image code for etag
|
||||
uid = None
|
||||
|
|
|
@ -158,26 +158,23 @@ class WebRequest(object):
|
|||
#TODO: remove
|
||||
@contextlib.contextmanager
|
||||
def registry_cr(self):
|
||||
return (self.registry, cr)
|
||||
return (self.registry, self.cr)
|
||||
|
||||
def _call_function(self, *args, **kwargs):
|
||||
self.authenticate()
|
||||
try:
|
||||
if self.registry:
|
||||
# ugly syntax only to get the __exit__ arguments to pass to self._cr
|
||||
request = self
|
||||
class with_obj(object):
|
||||
def __enter__(self):
|
||||
pass
|
||||
def __exit__(self, *args):
|
||||
if request._cr_cm:
|
||||
request._cr_cm.__exit__(*args)
|
||||
request._cr_cm = None
|
||||
request._cr = None
|
||||
# ugly syntax only to get the __exit__ arguments to pass to self._cr
|
||||
request = self
|
||||
class with_obj(object):
|
||||
def __enter__(self):
|
||||
pass
|
||||
def __exit__(self, *args):
|
||||
if request._cr_cm:
|
||||
request._cr_cm.__exit__(*args)
|
||||
request._cr_cm = None
|
||||
request._cr = None
|
||||
|
||||
with with_obj():
|
||||
return self.func(*args, **kwargs)
|
||||
else:
|
||||
with with_obj():
|
||||
return self.func(*args, **kwargs)
|
||||
finally:
|
||||
# just to be sure no one tries to re-use the request
|
||||
|
|
|
@ -104,6 +104,8 @@ class OpenERPSession(object):
|
|||
def authenticate(self, db, login, password, env=None):
|
||||
uid = self.proxy('common').authenticate(db, login, password, env)
|
||||
self.bind(db, uid, login, password)
|
||||
http.request.db = db
|
||||
http.request.uid = uid
|
||||
|
||||
if uid: self.get_context()
|
||||
return uid
|
||||
|
|
Loading…
Reference in New Issue