1011 |
1011 |
('1st-arrival', _('First arrival in status')),
|
1012 |
1012 |
('latest-arrival', _('Latest arrival in status')),
|
1013 |
1013 |
('finalized', _('Arrival in final status')),
|
1014 |
|
('python', _('Python expression')),
|
|
1014 |
('python', _('Expression')),
|
1015 |
1015 |
])
|
1016 |
1016 |
|
1017 |
1017 |
def properly_configured(self):
|
... | ... | |
1035 |
1035 |
form.add(StringWidget, 'anchor_expression', title=_('Expression'), size=80,
|
1036 |
1036 |
value=self.anchor_expression,
|
1037 |
1037 |
attrs={'data-dynamic-display-child-of': 'anchor',
|
1038 |
|
'data-dynamic-display-value': _('Python expression')})
|
|
1038 |
'data-dynamic-display-value': _('Expression')})
|
1039 |
1039 |
possible_status = [(None, _('Current Status'), None)]
|
1040 |
1040 |
possible_status.extend([('wf-%s' % x.id, x.name, x.id) for x in workflow.possible_status])
|
1041 |
1041 |
form.add(SingleSelectWidget, 'anchor_status_first', title=_('Status'),
|
... | ... | |
1096 |
1096 |
anchor_date = evolution.time
|
1097 |
1097 |
else:
|
1098 |
1098 |
break
|
1099 |
|
elif self.anchor == 'python':
|
|
1099 |
elif self.anchor == 'python': # actually both python & django expressions
|
1100 |
1100 |
variables = get_publisher().substitutions.get_context_variables()
|
1101 |
|
try:
|
1102 |
|
anchor_date = eval(self.anchor_expression,
|
1103 |
|
get_publisher().get_global_eval_dict(), variables)
|
1104 |
|
except:
|
1105 |
|
# get the variables in the locals() namespace so they are
|
1106 |
|
# displayed within the trace.
|
1107 |
|
expression = self.anchor_expression
|
1108 |
|
global_variables = get_publisher().get_global_eval_dict()
|
1109 |
|
get_publisher().notify_of_exception(sys.exc_info(), context='[TIMEOUTS]')
|
|
1101 |
if '{{' in self.anchor_expression or '{% 'in self.anchor_expression:
|
|
1102 |
anchor_date = Template(self.anchor_expression, autoescape=False).render(variables)
|
|
1103 |
else:
|
|
1104 |
try:
|
|
1105 |
anchor_date = eval(self.anchor_expression,
|
|
1106 |
get_publisher().get_global_eval_dict(), variables)
|
|
1107 |
except:
|
|
1108 |
# get the variables in the locals() namespace so they are
|
|
1109 |
# displayed within the trace.
|
|
1110 |
expression = self.anchor_expression
|
|
1111 |
global_variables = get_publisher().get_global_eval_dict()
|
|
1112 |
get_publisher().notify_of_exception(sys.exc_info(), context='[TIMEOUTS]')
|
1110 |
1113 |
|
1111 |
1114 |
# convert anchor_date to datetime.datetime()
|
1112 |
1115 |
if isinstance(anchor_date, datetime.datetime):
|
1113 |
|
-
|