equal
deleted
inserted
replaced
11 from datetime import datetime |
11 from datetime import datetime |
12 |
12 |
13 from cubicweb import UnknownProperty, ValidationError, BadConnectionId |
13 from cubicweb import UnknownProperty, ValidationError, BadConnectionId |
14 from cubicweb.schema import RQLVocabularyConstraint |
14 from cubicweb.schema import RQLVocabularyConstraint |
15 from cubicweb.server.pool import Operation, LateOperation, PreCommitOperation |
15 from cubicweb.server.pool import Operation, LateOperation, PreCommitOperation |
16 from cubicweb.server.hookhelper import (check_internal_entity, |
16 from cubicweb.server.hookhelper import (check_internal_entity, |
17 get_user_sessions, rproperty) |
17 get_user_sessions, rproperty) |
18 from cubicweb.server.repository import FTIndexEntityOp |
18 from cubicweb.server.repository import FTIndexEntityOp |
19 |
19 |
20 # special relations that don't have to be checked for integrity, usually |
20 # special relations that don't have to be checked for integrity, usually |
21 # because they are handled internally by hooks (so we trust ourselves) |
21 # because they are handled internally by hooks (so we trust ourselves) |
517 deststateeid = entity.get('to_state') |
517 deststateeid = entity.get('to_state') |
518 if not deststateeid: |
518 if not deststateeid: |
519 msg = session._('mandatory relation') |
519 msg = session._('mandatory relation') |
520 raise ValidationError(entity.eid, {'by_transition': msg}) |
520 raise ValidationError(entity.eid, {'by_transition': msg}) |
521 deststate = wf.state_by_eid(deststateeid) |
521 deststate = wf.state_by_eid(deststateeid) |
522 if not cowpowers and deststate is None: |
522 if deststate is None: |
523 msg = entity.req._("state doesn't belong to entity's workflow") |
523 msg = entity.req._("state doesn't belong to entity's current workflow") |
524 raise ValidationError(entity.eid, {'to_state': msg}) |
524 raise ValidationError(entity.eid, {'to_state': msg}) |
525 else: |
525 else: |
526 # check transition is valid and allowed, unless we're coming back from |
526 # check transition is valid and allowed, unless we're coming back from |
527 # subworkflow |
527 # subworkflow |
528 tr = session.entity_from_eid(treid) |
528 tr = session.entity_from_eid(treid) |