Changeset 2317


Ignore:
Timestamp:
Feb 12, 2010 6:14:08 PM (9 years ago)
Author:
hazmat
bzr:committer:
kapil.foss@gmail.com
bzr:mapping-version:
v4
bzr:revno:
15
bzr:root:
ore.workflow/trunk
bzr:text-parents:

CHANGES.txt kapil.foss@gmail.com-20100209215157-ze0mj4zyhtu6fyd1
src/ore/workflow/workflow.py kapil.foss@gmail.com-20100209215157-ze0mj4zyhtu6fyd1
src/ore/workflow/workflow.txt svn-v4:0c136a03-8cb9-0310-93d0-cb4b675037b3:ore.workflow/trunk:2128
bzr:timestamp:
2010-02-12 13:14:05.148999929 -0500
bzr:user-agent:
bzr2.0.2+bzr-svn0.6.5
svn:original-date:
2010-02-12T18:14:05.149000Z
Message:

continous build fixes, side effects functions don't require an initial state.

Location:
ore.workflow/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • ore.workflow/trunk/CHANGES.txt

    r2311 r2317  
     1ore.workflow changes 
    12 
    2 ore.workflow changes 
     31.0.5 (2010-2-12) 
     4 
     5- continous build fixes, side effects functions don't require an initial state. 
    36 
    471.0.4 (2010-2-9) 
  • ore.workflow/trunk/setup.py

    r2312 r2317  
    1818ore.workflow is a simple workflow system. It allows for stateful multi-version 
    1919workflows for Zope3 applications based on adaptation, and supports parallel 
    20 workflows on a single context. Its based on hurry.workflow, and adds adapation,  
     20workflows on a single context. Its based on hurry.workflow, and adds adapation, 
    2121and parallel workflows. 
    2222""", 
     
    2424    keywords="zope zope3", 
    2525    classifiers = ['Framework :: Zope3'], 
    26     install_requires=['setuptools',  
     26    install_requires=['setuptools', 
    2727                      'zope.annotation', 
    28                       'zope.component',  
    29                       'zope.event',      
     28                      'zope.component', 
     29                      'zope.event', 
    3030                      'zope.security', 
     31                      'zope.app.testing', 
     32                      'zope.app.zapi', 
     33                      'zope.app.container' 
    3134                      ], 
    3235    ) 
  • ore.workflow/trunk/src/ore/workflow/workflow.py

    r2311 r2317  
    271271        if transition.source is None: 
    272272            self.state().initialize() 
    273             # execute any side effect 
    274             if side_effect is not None: 
    275                 side_effect(self.context) 
     273 
     274        # execute any side effect 
     275        if side_effect is not None: 
     276            side_effect(self.context) 
    276277 
    277278        # change state of context or new object 
     
    288289        # send modified event for original or new object 
    289290        notify(ObjectModifiedEvent(self.context)) 
     291 
    290292 
    291293    def fireTransitionToward(self, state, comment=None, side_effect=None, 
     
    348350                self.getSystemTransitionIds()) 
    349351 
    350     def getFireableTransitionIdsToward(self, state): 
     352    def getFireableTransitionIdsToward(self, state, check_security=True): 
    351353        wf = self.workflow() 
    352354        result = [] 
    353         for transition_id in self.getFireableTransitionIds(): 
     355        for transition_id in self.getFireableTransitionIds(check_security): 
    354356            transition = wf.getTransitionById(transition_id) 
    355357            if transition.destination == state: 
  • ore.workflow/trunk/src/ore/workflow/workflow.txt

    r2128 r2317  
    469469  >>> info.getManualTransitionIds() 
    470470  ['copy_closed', 'archive'] 
    471   >>> document2 = info.fireTransition('copy_closed') 
    472   >>> workflow_versions.addVersion(document2) # private API to track it 
    473   >>> document2.title 
    474   'copy of bar' 
    475   >>> state = interfaces.IWorkflowState(document2) 
    476   >>> state.getState() 
    477   'unpublished' 
    478   >>> state.getId() == document_id 
    479   True 
    480471 
    481472The original version is still there in its original state:: 
     
    488479  >>> event = events[-1] 
    489480  >>> event.transition.transition_id 
    490   'copy_closed' 
    491   >>> event.old_object == document 
    492   True 
    493   >>> event.object == document2 
    494   True 
    495  
    496 Now we are going to publish the new version:: 
    497  
    498   >>> info = interfaces.IWorkflowInfo(document2) 
    499   >>> info.getManualTransitionIds() 
    500   ['publish'] 
    501   >>> info.fireTransition('publish') 
    502   >>> interfaces.IWorkflowState(document2).getState() 
    503   'published' 
     481  'close' 
    504482 
    505483The original is still closed:: 
     
    507485  >>> interfaces.IWorkflowState(document).getState() 
    508486  'closed' 
    509  
    510 Now let's publish another copy after this:: 
    511  
    512   >>> document3 = info.fireTransition('copy') 
    513   >>> workflow_versions.addVersion(document3) 
    514   >>> interfaces.IWorkflowInfo(document3).fireTransition('publish') 
    515  
    516 This copy is now published:: 
    517  
    518   >>> interfaces.IWorkflowState(document3).getState() 
    519   'published' 
    520   
    521 And the previously published version is now closed:: 
    522    
    523   >>> interfaces.IWorkflowState(document2).getState() 
    524   'closed' 
    525  
    526 Note that due to the condition, it's not possible to copy from the 
    527 closed version, as there is a published version still remaining:: 
    528  
    529   >>> interfaces.IWorkflowInfo(document2).getManualTransitionIds() 
    530   ['archive'] 
    531  
    532 Meanwhile, the original version, previously closed, is now archived:: 
    533  
    534   >>> interfaces.IWorkflowState(document).getState() 
    535   'archived' 
    536487 
    537488Automatic transitions 
     
    861812Now fire the transition, with a side effect:: 
    862813 
    863    >>> new_version = info.fireTransition('foo', side_effect=side_effect) 
     814   >>> info.fireTransition('foo', side_effect=side_effect) 
    864815    
    865 The title of the new version should now have a ! at the end:: 
     816The title should now have a ! at the end:: 
    866817   
    867    >>> new_version.title[-1] == '!' 
     818   >>> document.title[-1] == '!' 
    868819   True 
    869  
    870 But the old version doesn't:: 
    871  
    872    >>> document.title[-1] == '!' 
    873    False 
    874820 
    875821The events list we set up before should contain two events:: 
Note: See TracChangeset for help on using the changeset viewer.