server/test/data/migration/postcreate.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Mar 2010 13:59:47 +0100
branchstable
changeset 5013 ad91f93bbb93
parent 4252 6c4f109c2b03
child 5421 8167de96c523
permissions -rw-r--r--
[source storage] refactor source sql generation and results handling to allow repository side callbacks for instance with the BytesFileSystemStorage, before this change: * fspath, _fsopen function were stored procedures executed on the database -> files had to be available both on the repository *and* the database host * we needed implementation for each handled database Now, those function are python callbacks executed when necessary on the repository side, on data comming from the database. The litle cons are: * you can't do anymore restriction on mapped attributes * you can't write queries which will return in the same rset column some mapped attributes (or not mapped the same way) / some not This seems much acceptable since: * it's much more easy to handle when you start having the db on another host than the repo * BFSS works seemlessly on any backend now * you don't bother that much about the cons (at least in the bfss case): you usually don't do any restriction on Bytes... Bonus points: BFSS is more efficient (no queries under the cover as it was done in the registered procedure) and we have a much nicer/efficient fspath implementation. IMO, that rocks :D
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     1
"""cubicweb post creation script, set note's workflow
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     2
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     3
:organization: Logilab
4212
ab6573088b4a update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3363
diff changeset
     4
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
     7
"""
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
3363
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
     9
wf = add_workflow(u'note workflow', 'Note')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    10
todo = wf.add_state(u'todo', initial=True)
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    11
done = wf.add_state(u'done')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    12
wf.add_transition(u'redoit', done, todo)
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    13
wf.add_transition(u'markasdone', todo, done)
4191
01638461d4b0 test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3363
diff changeset
    14
commit()
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
3363
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    16
wf = add_workflow(u'affaire workflow', 'Affaire')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    17
pitetre = wf.add_state(u'pitetre', initial=True)
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    18
encours = wf.add_state(u'en cours')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    19
finie = wf.add_state(u'finie')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    20
bennon = wf.add_state(u'ben non')
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    21
wf.add_transition(u'abort', pitetre, bennon)
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    22
wf.add_transition(u'start', pitetre, encours)
d3736311d0c4 update to 3.5 wf api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    23
wf.add_transition(u'end', encours, finie)
4191
01638461d4b0 test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3363
diff changeset
    24
commit()
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25