##// END OF EJS Templates
ui: _get_cdata -> _data
Matt Mackall -
r8199:e9f90e59 default
parent child Browse files
Show More
@@ -127,16 +127,14 b' class ui(object):'
127 cdata.set(section, name, value)
127 cdata.set(section, name, value)
128 self.fixconfig()
128 self.fixconfig()
129
129
130 def _get_cdata(self, untrusted):
130 def _data(self, untrusted):
131 if untrusted:
131 return untrusted and self.ucdata or self.cdata
132 return self.ucdata
133 return self.cdata
134
132
135 def configsource(self, section, name, untrusted=False):
133 def configsource(self, section, name, untrusted=False):
136 return self._get_cdata(untrusted).source(section, name) or 'none'
134 return self._data(untrusted).source(section, name) or 'none'
137
135
138 def config(self, section, name, default=None, untrusted=False):
136 def config(self, section, name, default=None, untrusted=False):
139 value = self._get_cdata(untrusted).get(section, name, default)
137 value = self._data(untrusted).get(section, name, default)
140 if self.debugflag and not untrusted:
138 if self.debugflag and not untrusted:
141 uvalue = self.ucdata.get(section, name)
139 uvalue = self.ucdata.get(section, name)
142 if uvalue is not None and uvalue != value:
140 if uvalue is not None and uvalue != value:
@@ -164,10 +162,10 b' class ui(object):'
164
162
165 def has_section(self, section, untrusted=False):
163 def has_section(self, section, untrusted=False):
166 '''tell whether section exists in config.'''
164 '''tell whether section exists in config.'''
167 return section in self._get_cdata(untrusted)
165 return section in self._data(untrusted)
168
166
169 def configitems(self, section, untrusted=False):
167 def configitems(self, section, untrusted=False):
170 items = self._get_cdata(untrusted).items(section)
168 items = self._data(untrusted).items(section)
171 if self.debugflag and not untrusted:
169 if self.debugflag and not untrusted:
172 for k,v in self.ucdata.items(section):
170 for k,v in self.ucdata.items(section):
173 if self.cdata.get(section, k) != v:
171 if self.cdata.get(section, k) != v:
@@ -176,7 +174,7 b' class ui(object):'
176 return items
174 return items
177
175
178 def walkconfig(self, untrusted=False):
176 def walkconfig(self, untrusted=False):
179 cdata = self._get_cdata(untrusted)
177 cdata = self._data(untrusted)
180 for section in cdata.sections():
178 for section in cdata.sections():
181 for name, value in self.configitems(section, untrusted):
179 for name, value in self.configitems(section, untrusted):
182 yield section, name, str(value).replace('\n', '\\n')
180 yield section, name, str(value).replace('\n', '\\n')
General Comments 0
You need to be logged in to leave comments. Login now