openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #00449
[Merge] lp:~openerp-community/openerp-web/qoqenator_lp816835 into lp:openerp-web
Boris Timokhin has proposed merging lp:~openerp-community/openerp-web/qoqenator_lp816835 into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
Related bugs:
Bug #816835 in OpenERP Web: "cannot open CRM cases"
https://bugs.launchpad.net/openerp-web/+bug/816835
For more details, see:
https://code.launchpad.net/~openerp-community/openerp-web/qoqenator_lp816835/+merge/69968
--
https://code.launchpad.net/~openerp-community/openerp-web/qoqenator_lp816835/+merge/69968
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openerp-web/qoqenator_lp816835.
=== modified file 'addons/base/controllers/main.py'
--- addons/base/controllers/main.py 2011-07-28 16:18:53 +0000
+++ addons/base/controllers/main.py 2011-08-01 08:24:35 +0000
@@ -296,20 +296,30 @@
return [(id, name, clean_action(action, req.session))
for id, name, action in actions]
+def safe_eval(eval_string, context=None):
+ if context is None:
+ context = {}
+ try:
+ result = eval(eval_string, context)
+ except Exception, exc:
+ # TODO:
+ # 1. logger.getLoger('some_logger_name').exception(eval_string)
+ # 2. If exception type is NameError - need remove wrong piece
+ # from eval_string and return safe_eval(new_string)
+ return {}
+ return result
+
def clean_action(action, session):
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):
- action['context'] = eval(
- action['context'],
- session.evaluation_context()) or {}
-
+ action['context'] = safe_eval(action['context'],
+ session.evaluation_context()) or {}
if isinstance(action.get('domain', None), basestring):
- action['domain'] = eval(
- action['domain'],
- session.evaluation_context(
- action.get('context', {}))) or []
+ action['domain'] = safe_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()
Follow ups