diff --git a/openerpweb/nonliterals.py b/openerpweb/nonliterals.py index 8daf30c7423..5b61f39fc83 100644 --- a/openerpweb/nonliterals.py +++ b/openerpweb/nonliterals.py @@ -172,9 +172,8 @@ class Context(BaseContext): ctx = self.session.evaluation_context(context) if self.own: ctx.update(self.own) - return eval(self.get_context_string(), - SuperDict(ctx)) - + return eval(self.get_context_string(), SuperDict(ctx)) + class SuperDict(dict): def __getattr__(self, name): try: @@ -182,7 +181,7 @@ class SuperDict(dict): except KeyError: raise AttributeError(name) def __getitem__(self, key): - tmp = super(type(self), self).__getitem__(key) + tmp = super(SuperDict, self).__getitem__(key) if isinstance(tmp, dict): return SuperDict(tmp) return tmp @@ -208,8 +207,7 @@ class CompoundDomain(BaseDomain): ctx = dict(context or {}) ctx.update(self.get_eval_context() or {}) - ctx['context'] = ctx - + domain.session = self.session final_domain.extend(domain.evaluate(ctx)) return final_domain @@ -247,8 +245,7 @@ class CompoundContext(BaseContext): continue ctx.update(final_context) - ctx["context"] = ctx - + context_to_eval.session = self.session final_context.update(context_to_eval.evaluate(ctx)) return final_context diff --git a/openerpweb/openerpweb.py b/openerpweb/openerpweb.py index ee75ac0b1f9..eee0a4eec20 100644 --- a/openerpweb/openerpweb.py +++ b/openerpweb/openerpweb.py @@ -174,10 +174,10 @@ class OpenERPSession(object): :returns: the augmented context :rtype: dict """ - d = {} - d.update(self.base_eval_context) + d = dict(self.base_eval_context) if context: d.update(context) + d['context'] = d return d def eval_context(self, context_to_eval, context=None): @@ -197,7 +197,6 @@ class OpenERPSession(object): ctx = dict( self.base_eval_context, **(context or {})) - ctx['context'] = ctx # adding the context of the session to send to the openerp server ccontext = nonliterals.CompoundContext(self.context, context_to_eval or {}) @@ -222,12 +221,9 @@ class OpenERPSession(object): if isinstance(domain, list): return domain - ctx = dict(context or {}) - ctx['context'] = ctx - cdomain = nonliterals.CompoundDomain(domain) cdomain.session = self - return cdomain.evaluate(ctx) + return cdomain.evaluate(context or {}) #---------------------------------------------------------- # OpenERP Web RequestHandler