applicationsession
bzr revid: al@openerp.com-20110407030429-d6c26b10zduodir0
This commit is contained in:
parent
df73cbb7a8
commit
e8cbbeddff
|
@ -18,6 +18,25 @@ import simplejson
|
||||||
import nonliterals
|
import nonliterals
|
||||||
import xmlrpctimeout
|
import xmlrpctimeout
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
# Globals
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
path_root = os.path.dirname(os.path.dirname(os.path.normpath(__file__)))
|
||||||
|
path_addons = os.path.join(path_root, 'addons')
|
||||||
|
cherrypy_root = None
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
# Per Database Globals (might move into a pool if needed)
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
applicationsession = {}
|
||||||
|
addons_module = {}
|
||||||
|
addons_manifest = {}
|
||||||
|
controllers_class = {}
|
||||||
|
controllers_object = {}
|
||||||
|
controllers_path = {}
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# OpenERP Client Library
|
# OpenERP Client Library
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
|
@ -270,6 +289,7 @@ class JsonRequest(object):
|
||||||
def parse(self, request):
|
def parse(self, request):
|
||||||
self.request = request
|
self.request = request
|
||||||
self.params = request.get("params", {})
|
self.params = request.get("params", {})
|
||||||
|
self.applicationsession = applicationsession
|
||||||
self.httpsession_id = "cookieid"
|
self.httpsession_id = "cookieid"
|
||||||
self.httpsession = cherrypy.session
|
self.httpsession = cherrypy.session
|
||||||
self.session_id = self.params.pop("session_id", None) or uuid.uuid4().hex
|
self.session_id = self.params.pop("session_id", None) or uuid.uuid4().hex
|
||||||
|
@ -358,18 +378,21 @@ class HttpRequest(object):
|
||||||
"""
|
"""
|
||||||
def dispatch(self, controller, f, request, **kw):
|
def dispatch(self, controller, f, request, **kw):
|
||||||
self.request = request
|
self.request = request
|
||||||
|
self.applicationsession = applicationsession
|
||||||
self.httpsession_id = "cookieid"
|
self.httpsession_id = "cookieid"
|
||||||
self.httpsession = cherrypy.session
|
self.httpsession = cherrypy.session
|
||||||
self.result = ""
|
self.result = ""
|
||||||
print "GET/POST --> %s.%s %s %r" % (controller.__class__.__name__, f.__name__, request, kw)
|
print "GET/POST --> %s.%s %s %r" % (controller.__class__.__name__, f.__name__, request, kw)
|
||||||
r = f(controller, self, **kw)
|
r = f(controller, self, **kw)
|
||||||
|
print "<--", r
|
||||||
|
print
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def httprequest(f):
|
def httprequest(f):
|
||||||
# check cleaner wrapping:
|
# check cleaner wrapping:
|
||||||
# functools.wraps(f)(lambda x: JsonRequest().dispatch(x, f))
|
# functools.wraps(f)(lambda x: JsonRequest().dispatch(x, f))
|
||||||
def http_handler(self,*l, **kw):
|
def http_handler(self,*l, **kw):
|
||||||
HttpRequest().dispatch(self, f, cherrypy.request, **kw)
|
return HttpRequest().dispatch(self, f, cherrypy.request, **kw)
|
||||||
http_handler.exposed = 1
|
http_handler.exposed = 1
|
||||||
return http_handler
|
return http_handler
|
||||||
|
|
||||||
|
@ -377,17 +400,6 @@ def httprequest(f):
|
||||||
# Cherrypy stuff
|
# Cherrypy stuff
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
path_root = os.path.dirname(os.path.dirname(os.path.normpath(__file__)))
|
|
||||||
path_addons = os.path.join(path_root, 'addons')
|
|
||||||
cherrypy_root = None
|
|
||||||
|
|
||||||
# globals might move into a pool if needed
|
|
||||||
addons_module = {}
|
|
||||||
addons_manifest = {}
|
|
||||||
controllers_class = {}
|
|
||||||
controllers_object = {}
|
|
||||||
controllers_path = {}
|
|
||||||
|
|
||||||
class ControllerType(type):
|
class ControllerType(type):
|
||||||
def __init__(cls, name, bases, attrs):
|
def __init__(cls, name, bases, attrs):
|
||||||
super(ControllerType, cls).__init__(name, bases, attrs)
|
super(ControllerType, cls).__init__(name, bases, attrs)
|
||||||
|
|
Loading…
Reference in New Issue