1
# Copyright (C) 2008-2011 LottaNZB Development Team
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; version 3.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
Distributed configuration system with validation support, nested sections...
19
This module aims to simplify the handling of configuration data in an
20
application. It doesn't contain any information about the actual configuration
21
used by the application such as its structure, default values, validation
24
Configuration files are parsed and generated using Python's ConfigParser class,
25
so their fully standard-compliant. Subsections, which aren't covered by the
26
standard are implemented using the dot character, e. g. [section.subsection].
28
Each section and all of its content is stored as an instance of ConfigSection.
29
ConfigSection lets you enforce certain option value types and specify
30
validation routines, but this is not obligatory.
32
If this module needs to create a `ConfigSection` instance, it will look for a
33
class named `Config` in the application module that matches the section's name.
34
(e. g. the class `Config` in the modes module for the section called [modes]).
35
If it doesn't find such a customized class, it falls back to `ConfigSection`.
37
The class `Config` in this module loads and saves the configuration file.
39
Both options and subsections can be accessed either as attributes or using
42
print App().config.modes.active
43
App().config["plugins"].categories["enabled"] = False
47
from lottanzb.config.errors import *
48
from lottanzb.config.section import *
49
from lottanzb.config.roots import *