From 1011f4b2eb85c6fee44c16bfb95e766dd8378800 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 14 Apr 2008 11:44:45 +0000 Subject: [PATCH] make simplePublishing a function that returns a utility git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2525 fd906abe-77d9-0310-91a1-e0d9ade77398 --- stateful/README.txt | 2 +- stateful/publishing.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/stateful/README.txt b/stateful/README.txt index f095470..93a5eeb 100644 --- a/stateful/README.txt +++ b/stateful/README.txt @@ -37,7 +37,7 @@ More complex states definitions We'll use a predefined simple publishing workflow that. >>> from cybertools.stateful.publishing import simplePublishing - >>> registerStatesDefinition(simplePublishing) + >>> registerStatesDefinition(simplePublishing()) >>> demo = Demo() >>> demo.statesDefinition = 'publishing' diff --git a/stateful/publishing.py b/stateful/publishing.py index 80f8751..1f45f4f 100644 --- a/stateful/publishing.py +++ b/stateful/publishing.py @@ -22,18 +22,17 @@ Definition of a simple publishing workflow. $Id$ """ -from zope.interface import implements +from zope.interface import implementer from cybertools.stateful.definition import registerStatesDefinition from cybertools.stateful.definition import StatesDefinition from cybertools.stateful.definition import State, Transition +from cybertools.stateful.interfaces import IStatesDefinition -def simplePublishingFactory(): - return simplePublishing - - -simplePublishing = StatesDefinition('publishing', +@implementer(IStatesDefinition) +def simplePublishing(): + return StatesDefinition('publishing', State('private', 'private', ('show',)), State('draft', 'draft', ('publish', 'hide',)), State('published', 'published', ('retract',)),