rubbos installation guide
[bottlenecks.git] / vstf / vstf / controller / settings / README
1 This module providers a set of profile management solution
2 File:
3     settings.py
4 Interface:
5     Settings
6
7         1. it is a base class and supports two modes "Default" and "Single"
8            if the mode is "Default", the program will load the 'json' file from 'default'
9            and 'user' , merge the input, save only the 'json' file from 'user'
10            if the mode is "Single", the program will only load and save the 'json' file
11         2. it saves a file two, one is only in memory and the other is in file
12         3. it provides two types of functions, one is like "set_" and "add_" and the
13            other is like "mset" and "madd". the functions are automatically registered.
14
15         4. You can overload the function _register_func to achieve the functions what you desire
16            by function "_setting_file","_adding_file","_setting_memory" and "_addting_memory"
17
18         5. it provides "settings" to show the result in memory
19         6. it provides "reset" to reload the file
20
21 Example:
22
23     1. create your-settings file and paste the contents
24
25                 {
26                         "items1": "value1",
27                         "items2": "value2"
28                 }
29
30
31         2. create your_settings file and paste the codes
32
33         import vstf.controller.settings.settings as sets
34                 class YourSettings(sets.Settings):
35                         def __init__(self, path="./", filename="your-settings", mode=sets.SETS_SINGLE):
36                                 super(MailSettings, self).__init__(path, filename, mode)
37
38                 def unit_test():
39                         setting = YourSettings()
40                         print setting.settings()
41                         value1 = "test_set_items1"
42                         setting.set_items1(value1)
43                         print setting.settings()
44                         value2 = "test_set_items2"
45             setting.mset_items2(value2)
46             print setting.settings()
47             settings.reset()
48             print setting.settings()
49
50                 if __name__ == '__main__':
51                         unit_test()
52
53 Tree:
54
55     data_settings.py
56     flows_settings.py
57     perf_settings.py
58
59     mail_settings.py
60     tool_settings.py
61     html_settings.py