hooks/workflow.py
changeset 3072 6fb42c53f6df
parent 3024 bfaf056f1029
child 3376 f5c69485381f
--- a/hooks/workflow.py	Thu Aug 27 13:02:45 2009 +0200
+++ b/hooks/workflow.py	Mon Aug 31 19:09:54 2009 +0200
@@ -20,8 +20,12 @@
     nocheck = session.transaction_data.setdefault('skip-security', set())
     nocheck.add((x, 'in_state', oldstate))
     nocheck.add((x, 'in_state', newstate))
-    # delete previous state first in case we're using a super session
-    session.delete_relation(x, 'in_state', oldstate)
+    # delete previous state first in case we're using a super session,
+    # unless in_state isn't stored in the system source
+    fromsource = session.describe(x)[1]
+    if fromsource == 'system' or \
+           not session.repo.sources_by_uri[fromsource].support_relation('in_state'):
+        session.delete_relation(x, 'in_state', oldstate)
     session.add_relation(x, 'in_state', newstate)