equal
deleted
inserted
replaced
12 different states. Hence we have a set of states, and a "transition graph", |
12 different states. Hence we have a set of states, and a "transition graph", |
13 i.e. a list of possible transitions from one state to another state. |
13 i.e. a list of possible transitions from one state to another state. |
14 |
14 |
15 We will define a simple workflow for a blog, with only the following |
15 We will define a simple workflow for a blog, with only the following |
16 two states: `submitted` and `published`. So first, we create a simple |
16 two states: `submitted` and `published`. So first, we create a simple |
17 `CubicWeb` in ten minutes (see :ref:`BlogTenMinutes`). |
17 *CubicWeb* in ten minutes (see :ref:`BlogFiveMinutes`). |
18 |
18 |
19 Set-up a workflow |
19 Set-up a workflow |
20 ----------------- |
20 ----------------- |
21 |
21 |
22 We want to create a workflow to control the quality of the BlogEntry |
22 We want to create a workflow to control the quality of the BlogEntry |
58 |
58 |
59 Create states, transitions and group permissions |
59 Create states, transitions and group permissions |
60 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
60 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
61 |
61 |
62 The ``postcreate.py`` script is executed in a special environment, adding |
62 The ``postcreate.py`` script is executed in a special environment, adding |
63 several `CubicWeb` primitives that can be used. |
63 several *CubicWeb* primitives that can be used. |
64 They are all defined in the ``class ServerMigrationHelper``. |
64 They are all defined in the ``class ServerMigrationHelper``. |
65 We will only discuss the methods we use to create a workflow in this example. |
65 We will only discuss the methods we use to create a workflow in this example. |
66 |
66 |
67 To define our workflow for BlogDemo, please add the following lines |
67 To define our workflow for BlogDemo, please add the following lines |
68 to ``migration/postcreate.py``:: |
68 to ``migration/postcreate.py``:: |
129 |
129 |
130 Under the hood |
130 Under the hood |
131 ~~~~~~~~~~~~~~ |
131 ~~~~~~~~~~~~~~ |
132 |
132 |
133 A workflow is a collection of entities of type ``State`` and of type ``Transition`` |
133 A workflow is a collection of entities of type ``State`` and of type ``Transition`` |
134 which are standard `CubicWeb` entity types. |
134 which are standard *CubicWeb* entity types. |
135 For instance, the following lines:: |
135 For instance, the following lines:: |
136 |
136 |
137 submitted = add_state(_('submitted'), 'BlogEntry', initial=True) |
137 submitted = add_state(_('submitted'), 'BlogEntry', initial=True) |
138 published = add_state(_('published'), 'BlogEntry') |
138 published = add_state(_('published'), 'BlogEntry') |
139 |
139 |