diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-06-28 15:12:54 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-06-28 15:12:54 +0200 |
| commit | bbd9df8fc40995c42d47f87b85e40e9cda728051 (patch) | |
| tree | b3ca4f96eb271d6a6fd496ce70919dfbadae54ca | |
| parent | 46d87b34b0c1db9af6feb2fd4e9981360fea3977 (diff) | |
[imp] added super dict
bzr revid: nicolas.vanhoren@openerp.com-20110628131254-2cj2l9k4zsuxb7u0
| -rw-r--r-- | openerpweb/nonliterals.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/openerpweb/nonliterals.py b/openerpweb/nonliterals.py index 0cb3ee6347f..6aedc6bb359 100644 --- a/openerpweb/nonliterals.py +++ b/openerpweb/nonliterals.py @@ -123,7 +123,7 @@ class Domain(BaseDomain): ctx = self.session.evaluation_context(context) if self.own: ctx.update(self.own) - return eval(self.get_domain_string(), ctx) + return eval(self.get_domain_string(), SuperDict(ctx)) class Context(BaseContext): def __init__(self, session, context_string=None, key=None): @@ -169,7 +169,19 @@ class Context(BaseContext): if self.own: ctx.update(self.own) return eval(self.get_context_string(), - ctx) + SuperDict(ctx)) + +def SuperDict(dict): + def __getattr__(self, name): + try: + return self[name] + except KeyError: + raise AttributeError(name) + def __getitem__(self, key): + tmp = super(dict, self)[key] + if isinstance(tmp, dict): + return SuperDict(tmp) + return tmp class CompoundDomain(BaseDomain): def __init__(self, *domains): |
