[IMP] don't be a poopyhead, learn how to use dicts
authorXavier Morel <xmo@openerp.com>
Wed, 27 Jul 2011 15:09:42 +0000 (17:09 +0200)
committerXavier Morel <xmo@openerp.com>
Wed, 27 Jul 2011 15:09:42 +0000 (17:09 +0200)
bzr revid: xmo@openerp.com-20110727150942-oekqzfckrm29ixu6

addons/base/controllers/main.py

index e8e224c..15d0b99 100644 (file)
@@ -300,22 +300,21 @@ def load_actions_from_ir_values(req, key, key2, models, meta, context):
             for id, name, action in actions]
 
 def clean_action(action, session):
+    action.setdefault('flags', {})
     if action['type'] != 'ir.actions.act_window':
         return action
     # values come from the server, we can just eval them
-    if isinstance(action.get('context', None), basestring):
+    if isinstance(action.get('context'), basestring):
         action['context'] = eval(
             action['context'],
             session.evaluation_context()) or {}
 
-    if isinstance(action.get('domain', None), basestring):
+    if isinstance(action.get('domain'), basestring):
         action['domain'] = eval(
             action['domain'],
             session.evaluation_context(
                 action.get('context', {}))) or []
-    if 'flags' not in action:
-        # Set empty flags dictionary for web client.
-        action['flags'] = dict()
+
     return fix_view_modes(action)
 
 def generate_views(action):