B fix bugs in postcreate wflow and check_cycle
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 09 Aug 2009 18:41:56 +0200
changeset 51 d952ecde4fcb
parent 50 6a76822089d7
child 52 bc9b616aa2b7
B fix bugs in postcreate wflow and check_cycle
hooks.py
migration/postcreate.py
--- a/hooks.py	Thu Jul 30 20:01:05 2009 +0200
+++ b/hooks.py	Sun Aug 09 18:41:56 2009 +0200
@@ -62,7 +62,7 @@
             if parent.eid in parents:
                 msg = self.session._('detected subkeyword cycle')
                 raise ValidationError(self.fromeid, {'subkeyword_of': msg})
-            parents.append(add.eid)
+            parents.add(parent.eid)
 
 
 class SetIncludedInRelationHook(Hook):
--- a/migration/postcreate.py	Thu Jul 30 20:01:05 2009 +0200
+++ b/migration/postcreate.py	Sun Aug 09 18:41:56 2009 +0200
@@ -1,7 +1,7 @@
 # postcreate script. You could setup a workflow here for example
 # no explicit initial state for Keywords since it depends on the user's groups
 
-pending = add_state(_('validation pending'), ('Keyword', 'CodeKeyword'))
+pending = add_state(_('validation pending'), ('Keyword', 'CodeKeyword'), initial=True)
 validated = add_state(_('keyword validated'), ('Keyword', 'CodeKeyword'))
 rejected = add_state(_('keyword rejected'), ('Keyword', 'CodeKeyword'))
 add_transition(_('validate keyword'), ('Keyword', 'CodeKeyword'), (pending,), validated,