From 4ead71499e3dd3fc98912b2c1af4e115cc4ac872 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 26 Apr 2008 12:39:58 +0000 Subject: [PATCH] add 'archived' and 'removed' states to simple publishing git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2542 fd906abe-77d9-0310-91a1-e0d9ade77398 --- stateful/README.txt | 3 +++ stateful/publishing.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/stateful/README.txt b/stateful/README.txt index 93a5eeb..ef27cdb 100644 --- a/stateful/README.txt +++ b/stateful/README.txt @@ -44,6 +44,9 @@ We'll use a predefined simple publishing workflow that. >>> demo.getState() 'draft' + >>> [t.title for t in demo.getAvailableTransitions()] + ['publish', 'hide', 'archive', 'remove'] + If we try to execute a transition that is not an outgoing transition of the current state we get an error. diff --git a/stateful/publishing.py b/stateful/publishing.py index 1f45f4f..69c5128 100644 --- a/stateful/publishing.py +++ b/stateful/publishing.py @@ -33,11 +33,15 @@ from cybertools.stateful.interfaces import IStatesDefinition @implementer(IStatesDefinition) def simplePublishing(): return StatesDefinition('publishing', - State('private', 'private', ('show',)), - State('draft', 'draft', ('publish', 'hide',)), - State('published', 'published', ('retract',)), + State('private', 'private', ('show', 'archive', 'remove')), + State('draft', 'draft', ('publish', 'hide', 'archive', 'remove')), + State('published', 'published', ('retract', 'archive')), + State('archived', 'archived', ('show', 'remove')), + State('removed', 'removed', ('show',)), Transition('show', 'show', 'draft'), Transition('hide', 'hide', 'private'), Transition('publish', 'publish', 'published'), Transition('retract', 'retract', 'draft'), + Transition('archive', 'archive', 'archived'), + Transition('remove', 'remove', 'removed'), initialState='draft')