[FIX] handling of empty domains, context and view_id in action descriptors
* Some literal actions (not stored) provide an empty string for domains and contexts instead of (respectively) an empty array or an empty dict literal inside the string. Treat those case as nothing being provided. * Likewise some literal actions provide nonsensical (but falsy, but not False) values for view_id (such as an empty list). Yield a ``False`` view_id for all falsy ``view_id`` received (``0`` should not be a valid view_id, so ``False`` works) bzr revid: xmo@openerp.com-20120606123508-ndh3jpzw1nabf98n
This commit is contained in:
commit
85f95e6858
|
@ -683,10 +683,10 @@ def clean_action(req, action, do_not_eval=False):
|
|||
|
||||
if not do_not_eval:
|
||||
# values come from the server, we can just eval them
|
||||
if isinstance(action.get('context'), basestring):
|
||||
if action.get('context') and isinstance(action.get('context'), basestring):
|
||||
action['context'] = eval( action['context'], eval_ctx ) or {}
|
||||
|
||||
if isinstance(action.get('domain'), basestring):
|
||||
if action.get('domain') and isinstance(action.get('domain'), basestring):
|
||||
action['domain'] = eval( action['domain'], eval_ctx ) or []
|
||||
else:
|
||||
if 'context' in action:
|
||||
|
@ -719,7 +719,7 @@ def generate_views(action):
|
|||
|
||||
:param dict action: action descriptor dictionary to generate a views key for
|
||||
"""
|
||||
view_id = action.get('view_id', False)
|
||||
view_id = action.get('view_id') or False
|
||||
if isinstance(view_id, (list, tuple)):
|
||||
view_id = view_id[0]
|
||||
|
||||
|
|
Loading…
Reference in New Issue