equal
deleted
inserted
replaced
21 * workflow entities views (State, Transition, TrInfo) |
21 * workflow entities views (State, Transition, TrInfo) |
22 """ |
22 """ |
23 |
23 |
24 |
24 |
25 from cubicweb import _ |
25 from cubicweb import _ |
26 |
|
27 from six import text_type |
|
28 |
26 |
29 from logilab.mtconverter import xml_escape |
27 from logilab.mtconverter import xml_escape |
30 |
28 |
31 from cubicweb import Unauthorized |
29 from cubicweb import Unauthorized |
32 from cubicweb.predicates import (one_line_rset, |
30 from cubicweb.predicates import (one_line_rset, |
307 |
305 |
308 def _wf_items_for_relation(req, wfeid, wfrelation, field): |
306 def _wf_items_for_relation(req, wfeid, wfrelation, field): |
309 wf = req.entity_from_eid(wfeid) |
307 wf = req.entity_from_eid(wfeid) |
310 rschema = req.vreg.schema[field.name] |
308 rschema = req.vreg.schema[field.name] |
311 param = 'toeid' if field.role == 'subject' else 'fromeid' |
309 param = 'toeid' if field.role == 'subject' else 'fromeid' |
312 return sorted((e.view('combobox'), text_type(e.eid)) |
310 return sorted((e.view('combobox'), str(e.eid)) |
313 for e in getattr(wf, 'reverse_%s' % wfrelation) |
311 for e in getattr(wf, 'reverse_%s' % wfrelation) |
314 if rschema.has_perm(req, 'add', **{param: e.eid})) |
312 if rschema.has_perm(req, 'add', **{param: e.eid})) |
315 |
313 |
316 |
314 |
317 # TrInfo |
315 # TrInfo |