[Checkins] SVN: Grokstar/trunk/src/grokstar/ use workflow action
system to update published datetime so it will always
Martijn Faassen
faassen at infrae.com
Thu Feb 1 17:49:38 EST 2007
Log message for revision 72315:
use workflow action system to update published datetime so it will always
happen during event transition.
Changed:
U Grokstar/trunk/src/grokstar/entry.py
U Grokstar/trunk/src/grokstar/workflow.py
-=-
Modified: Grokstar/trunk/src/grokstar/entry.py
===================================================================
--- Grokstar/trunk/src/grokstar/entry.py 2007-02-01 22:25:15 UTC (rev 72314)
+++ Grokstar/trunk/src/grokstar/entry.py 2007-02-01 22:49:37 UTC (rev 72315)
@@ -57,7 +57,6 @@
@grok.action('Publish')
def publish(self, **data):
self.applyChanges(**data)
- self.context.published = datetime.now()
IWorkflowInfo(self.context).fireTransitionToward(interfaces.PUBLISHED)
self.redirect(self.url(self.context))
Modified: Grokstar/trunk/src/grokstar/workflow.py
===================================================================
--- Grokstar/trunk/src/grokstar/workflow.py 2007-02-01 22:25:15 UTC (rev 72314)
+++ Grokstar/trunk/src/grokstar/workflow.py 2007-02-01 22:49:37 UTC (rev 72315)
@@ -1,3 +1,5 @@
+from datetime import datetime
+
import grok
from grokstar.entry import Entry
from hurry.workflow import workflow
@@ -7,6 +9,9 @@
from grokstar.interfaces import CREATED, PUBLISHED
+def publish_action(info, context):
+ context.published = datetime.now()
+
def create_workflow():
create_transition = workflow.Transition(
transition_id='create',
@@ -18,13 +23,15 @@
transition_id='publish',
title='publish',
source=CREATED,
- destination=PUBLISHED)
+ destination=PUBLISHED,
+ action=publish_action)
update_transition = workflow.Transition(
transition_id='update',
title='update',
source=PUBLISHED,
- destination=PUBLISHED)
+ destination=PUBLISHED,
+ action=publish_action)
return [create_transition, publish_transition, update_transition]
More information about the Checkins
mailing list