merge
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 23 Nov 2009 14:13:53 +0100
changeset 3895 92ead039d3d0
parent 3892 c53df9a310a6 (current diff)
parent 3894 27cbf98ad863 (diff)
child 3998 94cc7cad3d2d
merge
--- a/hooks/integrity.py	Fri Nov 20 23:44:57 2009 +0100
+++ b/hooks/integrity.py	Mon Nov 23 14:13:53 2009 +0100
@@ -93,10 +93,7 @@
             # skip automatically handled relations
             if rschema.type in DONT_CHECK_RTYPES_ON_ADD:
                 continue
-            if role == 'subject':
-                opcls = _CheckSRelationOp
-            else:
-                opcls = _CheckORelationOp
+            opcls = role == 'subject' and _CheckSRelationOp or _CheckORelationOp
             rdef = rschema.role_rdef(eschema, targetschemas[0], role)
             if rdef.role_cardinality(role) in '1+':
                 self.checkrel_if_necessary(opcls, rschema.type, eid)
--- a/hooks/workflow.py	Fri Nov 20 23:44:57 2009 +0100
+++ b/hooks/workflow.py	Mon Nov 23 14:13:53 2009 +0100
@@ -202,8 +202,8 @@
         try:
             treid = entity['by_transition']
         except KeyError:
-            # no transition set, check user is a manager and destination state is
-            # specified (and valid)
+            # no transition set, check user is a manager and destination state
+            # is specified (and valid)
             if not cowpowers:
                 msg = session._('mandatory relation')
                 raise ValidationError(entity.eid, {'by_transition': msg})
@@ -216,8 +216,8 @@
                 msg = session._("state doesn't belong to entity's workflow")
                 raise ValidationError(entity.eid, {'to_state': msg})
         else:
-            # check transition is valid and allowed, unless we're coming back from
-            # subworkflow
+            # check transition is valid and allowed, unless we're coming back
+            # from subworkflow
             tr = session.entity_from_eid(treid)
             if swtr is None:
                 if tr is None: