[FIX] service: wrapper: fixed context fetching. Indeed call_kw set its context
authorThibault Delavallée <tde@openerp.com>
Wed, 7 May 2014 11:06:37 +0000 (13:06 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 7 May 2014 11:06:37 +0000 (13:06 +0200)
in kwargs of kwargs, leading to a kwargception.

bzr revid: tde@openerp.com-20140507110637-qlj1rj8lrcpkejf6

openerp/service/model.py

index d65cbd7..2bbba4e 100644 (file)
@@ -54,7 +54,8 @@ def check(f):
                 if args and isinstance(args[-1], dict):
                     ctx = args[-1]
             elif isinstance(kwargs, dict):
-                ctx = kwargs.get('context', {})
+                # kwargception because call_kw set its context in kwargs['kwargs']
+                ctx = kwargs.get('context', kwargs.get('kwargs', {}).get('context', {}))
 
             uid = 1
             if args and isinstance(args[0], (long, int)):