Code Repositories xandikos / bc06fec
Add missing config file. Jelmer Vernooń≥ 2 years ago
1 changed file(s) with 51 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # Xandikos
1 # Copyright (C) 2016-2017 Jelmer Vernooń≥ <jelmer@jelmer.uk>, et al.
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; version 3
6 # of the License or (at your option) any later version of
7 # the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 # MA 02110-1301, USA.
18
19 """Collection configuration file.
20 """
21
22 import configparser
23
24 FILENAME = '.xandikos'
25
26
27 class CollectionConfig(object):
28
29 def __init__(self, cp=None):
30 if cp is None:
31 cp = configparser.ConfigParser()
32 self._configparser = cp
33
34 @classmethod
35 def from_file(cls, f):
36 cp = configparser.ConfigParser()
37 cp.read_file(f)
38 return CollectionConfig(cp)
39
40 def get_color(self):
41 return self._configparser['DEFAULT']['color']
42
43 def get_comment(self):
44 return self._configparser['DEFAULT']['comment']
45
46 def get_displayname(self):
47 return self._configparser['DEFAULT']['displayname']
48
49 def get_description(self):
50 return self._configparser['DEFAULT']['description']