From 28ea4f0e9006278c66ba211459c2923a4453e367 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 10 Sep 2013 21:04:12 +0200 Subject: [PATCH] update doc --- doc/api.txt | 1 + doc/consistency.txt | 23 +- doc/index.txt | 1 + doc/storage.png | Bin 0 -> 15867 bytes doc/storage.svg | 265 ++++++++++++++++++++++++ doc/storage.txt | 52 +++++ tiramisu/storage/__init__.py | 10 +- tiramisu/storage/dictionary/__init__.py | 13 +- tiramisu/storage/dictionary/storage.py | 3 +- tiramisu/storage/sqlite3/__init__.py | 11 +- tiramisu/storage/sqlite3/storage.py | 3 + 11 files changed, 355 insertions(+), 27 deletions(-) create mode 100644 doc/storage.png create mode 100644 doc/storage.svg create mode 100644 doc/storage.txt diff --git a/doc/api.txt b/doc/api.txt index 1498f14..7fb526f 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -11,4 +11,5 @@ Auto generated library's API tiramisu.value tiramisu.autolib tiramisu.error + tiramisu.storage diff --git a/doc/consistency.txt b/doc/consistency.txt index 4b268ed..9de8748 100644 --- a/doc/consistency.txt +++ b/doc/consistency.txt @@ -57,7 +57,7 @@ A requirement is a list of dictionaries that have fairly this form:: 'transitive':True, 'same_action': True}] Actually a transformation is made to this dictionary during the validation of -this requires at the :class:`~option.Option()`'s init. The dictionairy becomes +this requires at the :class:`~option.Option()`'s init. The dictionary becomes a tuple, wich is passed to the :meth:`~setting.Settings.apply_requires()` method. Take a look at the code to fully understand the exact meaning of the requirements: @@ -103,7 +103,6 @@ hidden any more:: ['hidden'] >>> print c.od1.var1 Traceback (most recent call last): - [...] tiramisu.error.PropertiesOptionError: trying to access to an option named: var1 with properties ['hidden'] >>> c.od1.var2 = u'oui' @@ -123,7 +122,6 @@ document.):: >>> c.od1.var2 = u'non' >>> print c.od2.var4 Traceback (most recent call last): - [...] tiramisu.error.PropertiesOptionError: trying to access to an option named: od2 with properties ['hidden'] >>> c.od1.var2 = u'oui' >>> print c.od2.var4 @@ -144,21 +142,20 @@ Requirements can be accumulated for different or identical properties (inverted or not):: >>> a = UnicodeOption('var3', '', u'value', requires=[{'option':od1.var2, - 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'expected':'oui', - 'action':'hidden'}]) + ... 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'expected':'oui', + ... 'action':'hidden'}]) >>> a = UnicodeOption('var3', '', u'value', requires=[{'option':od1.var2, - 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'excepted':'oui', - 'action':'disabled', 'inverse':True}]) + ... 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'excepted':'oui', + ... 'action':'disabled', 'inverse':True}]) But it is not possible to have inverted requirements on the same property. Here is an impossible situation:: >>> a = UnicodeOption('var3', '', u'value', requires=[{'option':od1.var2, - 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'expected':'oui', - 'hidden', True}]) + ... 'expected':'non', 'action':'hidden'}, {'option':od1.var1, 'expected':'oui', + ... 'hidden', True}]) Traceback (most recent call last): - [...] ValueError: inconsistency in action types for option: var3 action: hidden Validation upon a whole configuration object @@ -184,11 +181,8 @@ Let's define validator (wich is a normal python function):: Here is an option wich uses this validator:: >>> var1 = UnicodeOption('var1', '', u'oui', validator=valid_a, validator_args={'letter': 'o'}) - >>> >>> od1 = OptionDescription('od1', '', [var1]) - >>> >>> rootod = OptionDescription('rootod', '', [od1]) - >>> >>> c = Config(rootod) >>> c.read_write() @@ -196,11 +190,10 @@ The validation is applied at the modification time:: >>> c.od1.var1 = u'non' Traceback (most recent call last): - [...] ValueError: invalid value non for option var1 >>> c.od1.var1 = u'oh non' - Il est possible de désactiver la validation : +You can disabled this validation:: >>> c.cfgimpl_get_settings().remove('validator') >>> c.od1.var1 = u'non' diff --git a/doc/index.txt b/doc/index.txt index 21cf692..c073d99 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -33,6 +33,7 @@ controlling options explanations getting-started config + storage option status consistency diff --git a/doc/storage.png b/doc/storage.png new file mode 100644 index 0000000000000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 -0,0 +1,265 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + Config + + + + + Values + + + + Settings + + + + + + + + + + + + Storage + + + Option + + + + diff --git a/doc/storage.txt b/doc/storage.txt new file mode 100644 index 0000000..8ff5d93 --- /dev/null +++ b/doc/storage.txt @@ -0,0 +1,52 @@ +Storage +======= + +Config's informations are, by default, volatiles. This means, all values and +settings changes will be lost. + +The storage is the system Tiramisu uses to communicate with various DB. +You can specified a persistent storage. + +.. image:: storage.png + +.. automodule:: tiramisu.storage + +.. automethod:: tiramisu.storage.set_storage + +Dictionary +~~~~~~~~~~ + +.. automodule:: tiramisu.storage.dictionary + +Dictionary settings: + +.. automethod:: tiramisu.storage.dictionary.storage.Setting + +Sqlite3 +~~~~~~~ + +.. automodule:: tiramisu.storage.sqlite3 + +Sqlite3 settings: + +.. automethod:: tiramisu.storage.sqlite3.storage.Setting + +Example +~~~~~~~ + +>>> from tiramisu.option import StrOption, OptionDescription +>>> from tiramisu.config import Config +>>> from tiramisu.storage import set_storage +>>> set_storage('sqlite3', dir_database='/tmp/tiramisu') +>>> s = StrOption('str', '') +>>> o = OptionDescription('od', '', [s]) +>>> c1 = Config(o, persistent=True, session_id='xxxx') +>>> c1.str +>>> c1.str = 'yes' +>>> c1.str +'yes' +>>> del(c1) +>>> c2 = Config(o, persistent=True, session_id='xxxx') +>>> c2.str +'yes' + diff --git a/tiramisu/storage/__init__.py b/tiramisu/storage/__init__.py index 562aad5..147d8a8 100644 --- a/tiramisu/storage/__init__.py +++ b/tiramisu/storage/__init__.py @@ -19,11 +19,9 @@ # the whole pypy projet is under MIT licence # ____________________________________________________________ -"""Storage connections, executions and managements. - -Storage is basic components used to set Config informations in DB. -The primary "entry point" class into this package is the StorageType and it's -public configurator ``set_storage()``. +"""Storage is basic components used to set Config informations in DB. +The primary "entry point" class is the StorageType and it's public +configurator ``set_storage()``. """ @@ -43,6 +41,8 @@ class StorageType(object): def set(self, name): if self.storage_type is not None: + if self.storage_type == name: + return raise ConfigError(_('storage_type is already set, cannot rebind it')) self.storage_type = name diff --git a/tiramisu/storage/dictionary/__init__.py b/tiramisu/storage/dictionary/__init__.py index a53e505..dadce23 100644 --- a/tiramisu/storage/dictionary/__init__.py +++ b/tiramisu/storage/dictionary/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -"default plugin for storage: set it in a simple dictionary" # Copyright (C) 2013 Team tiramisu (see AUTHORS for all contributors) # # This program is free software; you can redistribute it and/or modify @@ -17,8 +16,16 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ____________________________________________________________ +"""Default plugin for storage. All informations are store in a simple +dictionary in memory. + +You cannot have persistente informations with this kind of storage. + +The advantage of this solution is that you can easily create a Config and +use it. But if something goes wrong, you will lost your modifications. +""" from .value import Values from .setting import Settings -from .storage import Storage, list_sessions, delete_session +from .storage import Setting, Storage, list_sessions, delete_session -__all__ = (Values, Settings, Storage, list_sessions, delete_session) +__all__ = (Setting, Values, Settings, Storage, list_sessions, delete_session) diff --git a/tiramisu/storage/dictionary/storage.py b/tiramisu/storage/dictionary/storage.py index 5442c5d..6e15c1b 100644 --- a/tiramisu/storage/dictionary/storage.py +++ b/tiramisu/storage/dictionary/storage.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -"default plugin for storage: set it in a simple dictionary" # Copyright (C) 2013 Team tiramisu (see AUTHORS for all contributors) # # This program is free software; you can redistribute it and/or modify @@ -22,6 +21,8 @@ from tiramisu.error import ConfigError class Setting(object): + """Dictionary storage has no particular setting. + """ pass diff --git a/tiramisu/storage/sqlite3/__init__.py b/tiramisu/storage/sqlite3/__init__.py index adcdfdc..dc6c14b 100644 --- a/tiramisu/storage/sqlite3/__init__.py +++ b/tiramisu/storage/sqlite3/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -"set storage in sqlite3" # Copyright (C) 2013 Team tiramisu (see AUTHORS for all contributors) # # This program is free software; you can redistribute it and/or modify @@ -17,8 +16,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ____________________________________________________________ +"""Sqlite3 plugin for storage. This storage is not made to be used in productive +environment. It was developing as proof of concept. + +You should not configure differents Configs with same session_id. + +""" from .value import Values from .setting import Settings -from .storage import Storage, list_sessions, delete_session +from .storage import Setting, Storage, list_sessions, delete_session -__all__ = (Values, Settings, Storage, list_sessions, delete_session) +__all__ = (Setting, Values, Settings, Storage, list_sessions, delete_session) diff --git a/tiramisu/storage/sqlite3/storage.py b/tiramisu/storage/sqlite3/storage.py index ed5abd9..2ab8e08 100644 --- a/tiramisu/storage/sqlite3/storage.py +++ b/tiramisu/storage/sqlite3/storage.py @@ -25,6 +25,9 @@ from glob import glob class Setting(object): + """:param extension: database file extension (by default: db) + :param dir_database: root database directory (by default: /tmp) + """ extension = 'db' dir_database = '/tmp'