ui: _get_cdata -> _data
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Apr 2009 16:50:44 -0500
changeset 8199 e9f90e5989d9
parent 8198 cf9accffd0b3
child 8200 865d2c646f29
ui: _get_cdata -> _data
mercurial/ui.py
--- a/mercurial/ui.py	Sun Apr 26 16:50:43 2009 -0500
+++ b/mercurial/ui.py	Sun Apr 26 16:50:44 2009 -0500
@@ -127,16 +127,14 @@
             cdata.set(section, name, value)
         self.fixconfig()
 
-    def _get_cdata(self, untrusted):
-        if untrusted:
-            return self.ucdata
-        return self.cdata
+    def _data(self, untrusted):
+        return untrusted and self.ucdata or self.cdata
 
     def configsource(self, section, name, untrusted=False):
-        return self._get_cdata(untrusted).source(section, name) or 'none'
+        return self._data(untrusted).source(section, name) or 'none'
 
     def config(self, section, name, default=None, untrusted=False):
-        value = self._get_cdata(untrusted).get(section, name, default)
+        value = self._data(untrusted).get(section, name, default)
         if self.debugflag and not untrusted:
             uvalue = self.ucdata.get(section, name)
             if uvalue is not None and uvalue != value:
@@ -164,10 +162,10 @@
 
     def has_section(self, section, untrusted=False):
         '''tell whether section exists in config.'''
-        return section in self._get_cdata(untrusted)
+        return section in self._data(untrusted)
 
     def configitems(self, section, untrusted=False):
-        items = self._get_cdata(untrusted).items(section)
+        items = self._data(untrusted).items(section)
         if self.debugflag and not untrusted:
             for k,v in self.ucdata.items(section):
                 if self.cdata.get(section, k) != v:
@@ -176,7 +174,7 @@
         return items
 
     def walkconfig(self, untrusted=False):
-        cdata = self._get_cdata(untrusted)
+        cdata = self._data(untrusted)
         for section in cdata.sections():
             for name, value in self.configitems(section, untrusted):
                 yield section, name, str(value).replace('\n', '\\n')