##// END OF EJS Templates
config: add some helper methods
Matt Mackall -
r8186:6a0018cd default
parent child Browse files
Show More
@@ -27,7 +27,7 b' class sortdict(dict):'
27 dict.__delitem__(self, key)
27 dict.__delitem__(self, key)
28 self._list.remove(key)
28 self._list.remove(key)
29
29
30 class config:
30 class config(object):
31 def __init__(self, data=None):
31 def __init__(self, data=None):
32 self._data = {}
32 self._data = {}
33 self._source = {}
33 self._source = {}
@@ -39,6 +39,11 b' class config:'
39 return config(self)
39 return config(self)
40 def __contains__(self, section):
40 def __contains__(self, section):
41 return section in self._data
41 return section in self._data
42 def __getitem__(self, section):
43 return self._data.get(section, {})
44 def __iter__(self):
45 for d in self.sections():
46 yield d
42 def update(self, src, sections=None):
47 def update(self, src, sections=None):
43 if not sections:
48 if not sections:
44 sections = src.sections()
49 sections = src.sections()
General Comments 0
You need to be logged in to leave comments. Login now