prefill: add globals on python formulas

This commit is contained in:
Thomas NOËL 2012-09-05 15:52:42 +02:00
parent fee585b041
commit d5171fa2c5
1 changed files with 3 additions and 2 deletions

View File

@ -442,9 +442,10 @@ class FormPage(Directory):
break
elif t == 'formula':
formula = field.prefill.get('value')
variables = get_publisher().substitutions.get_context_variables()
try:
v = str(eval(formula, variables))
v = str(eval(formula,
get_publisher().get_global_eval_dict(),
get_publisher().substitutions.get_context_variables()))
except:
pass
if v: