997 |
997 |
key = 'timeout'
|
998 |
998 |
anchor = None
|
999 |
999 |
anchor_expression = None
|
|
1000 |
anchor_template = None
|
1000 |
1001 |
anchor_status_first = None
|
1001 |
1002 |
anchor_status_latest = None
|
1002 |
1003 |
timeout = None
|
1003 |
1004 |
|
1004 |
1005 |
def get_parameters(self):
|
1005 |
|
return ('anchor', 'anchor_expression', 'anchor_status_first',
|
|
1006 |
return ('anchor', 'anchor_expression', 'anchor_template', 'anchor_status_first',
|
1006 |
1007 |
'anchor_status_latest', 'timeout')
|
1007 |
1008 |
|
1008 |
1009 |
def get_anchor_labels(self):
|
... | ... | |
1011 |
1012 |
('1st-arrival', _('First arrival in status')),
|
1012 |
1013 |
('latest-arrival', _('Latest arrival in status')),
|
1013 |
1014 |
('finalized', _('Arrival in final status')),
|
|
1015 |
('template', _('Text / Template')),
|
1014 |
1016 |
('python', _('Python expression')),
|
1015 |
1017 |
])
|
1016 |
1018 |
|
... | ... | |
1036 |
1038 |
value=self.anchor_expression,
|
1037 |
1039 |
attrs={'data-dynamic-display-child-of': 'anchor',
|
1038 |
1040 |
'data-dynamic-display-value': _('Python expression')})
|
|
1041 |
|
|
1042 |
form.add(StringWidget, 'anchor_template', title=_('Text / Template'), size=80,
|
|
1043 |
value=self.anchor_expression,
|
|
1044 |
attrs={'data-dynamic-display-child-of': 'anchor',
|
|
1045 |
'data-dynamic-display-value': _('Text / Template')})
|
|
1046 |
|
1039 |
1047 |
possible_status = [(None, _('Current Status'), None)]
|
1040 |
1048 |
possible_status.extend([('wf-%s' % x.id, x.name, x.id) for x in workflow.possible_status])
|
1041 |
1049 |
form.add(SingleSelectWidget, 'anchor_status_first', title=_('Status'),
|
... | ... | |
1096 |
1104 |
anchor_date = evolution.time
|
1097 |
1105 |
else:
|
1098 |
1106 |
break
|
|
1107 |
elif self.anchor == 'template':
|
|
1108 |
variables = get_publisher().substitutions.get_context_variables()
|
|
1109 |
anchor_date = Template(self.anchor_template, autoescape=False).render(variables)
|
1099 |
1110 |
elif self.anchor == 'python':
|
1100 |
1111 |
variables = get_publisher().substitutions.get_context_variables()
|
1101 |
1112 |
try:
|
1102 |
|
-
|