##// 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 27 dict.__delitem__(self, key)
28 28 self._list.remove(key)
29 29
30 class config:
30 class config(object):
31 31 def __init__(self, data=None):
32 32 self._data = {}
33 33 self._source = {}
@@ -39,6 +39,11 b' class config:'
39 39 return config(self)
40 40 def __contains__(self, section):
41 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 47 def update(self, src, sections=None):
43 48 if not sections:
44 49 sections = src.sections()
General Comments 0
You need to be logged in to leave comments. Login now