[FIX] strip server action code before passing it to eval
authorXavier Morel <xmo@openerp.com>
Mon, 4 Mar 2013 16:44:23 +0000 (17:44 +0100)
committerXavier Morel <xmo@openerp.com>
Mon, 4 Mar 2013 16:44:23 +0000 (17:44 +0100)
Python 2.7's compile handles trailing whitespaces correctly, Python
2.6 does not and blows up.

bzr revid: xmo@openerp.com-20130304164423-83vm9teu7b3c52y3

openerp/addons/base/ir/ir_actions.py

index 4404b0a..526c614 100644 (file)
@@ -608,7 +608,7 @@ class actions_server(osv.osv):
                     .read(cr, uid, action.action_id.id, context=context)
 
             if action.state=='code':
-                eval(action.code, cxt, mode="exec", nocopy=True) # nocopy allows to return 'action'
+                eval(action.code.strip(), cxt, mode="exec", nocopy=True) # nocopy allows to return 'action'
                 if 'action' in cxt:
                     return cxt['action']