6bfb18c8ac7bf4880f54a18b52924009a25d1aff
[tiramisu.git] / doc / storage.txt
1 Storage
2 =======
3
4 .. automodule:: tiramisu.storage
5
6 .. automethod:: tiramisu.storage.set_storage
7
8 .. image:: storage.png
9
10 Dictionary
11 ~~~~~~~~~~
12
13 .. automodule:: tiramisu.storage.dictionary
14
15 Dictionary settings:
16
17 .. automethod:: tiramisu.storage.dictionary.storage.Setting
18
19 Sqlite3
20 ~~~~~~~
21
22 .. automodule:: tiramisu.storage.sqlite3
23
24 Sqlite3 settings:
25
26 .. automethod:: tiramisu.storage.sqlite3.storage.Setting
27
28 Example
29 ~~~~~~~
30
31 >>> from tiramisu.option import StrOption, OptionDescription
32 >>> from tiramisu.config import Config
33 >>> from tiramisu.storage import set_storage
34 >>> set_storage('sqlite3', dir_database='/tmp/tiramisu')
35 >>> s = StrOption('str', '')
36 >>> o = OptionDescription('od', '', [s])
37 >>> c1 = Config(o, persistent=True, session_id='xxxx')
38 >>> c1.str
39 >>> c1.str = 'yes'
40 >>> c1.str
41 'yes'
42 >>> del(c1)
43 >>> c2 = Config(o, persistent=True, session_id='xxxx')
44 >>> c2.str
45 'yes'
46 >>> del(c2)
47 >>> list_sessions()
48 ['xxxx']
49 >>> delete_session('xxxx')
50 >>> c3 = Config(o, persistent=True, session_id='xxxx')
51 >>> c3.str
52