Changeset 619 in tailor
- Timestamp:
- 08/18/05 14:52:34 (8 years ago)
- Hash name:
- 20050818125234-97f81-80f613b68b5c134b9e6705968261cdfa7cdb8a64
- File:
-
- 1 edited
-
vcpx/config.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/config.py
r612 r619 54 54 return defaultp or [s for s in self.sections() if not ':' in s] 55 55 56 def get(self, section, option, default=None, vars=None): 57 """ 58 Return the requested option value if present, otherwise the default. 56 def get(self, section, option, default=None, raw=False, vars=None): 57 """Get an option value for a given section or the default value. 58 59 All % interpolations are expanded in the return values, based on the 60 defaults passed into the constructor, unless the optional argument 61 `raw' is true. Additional substitutions may be provided using the 62 `vars' argument, which must be a dictionary whose contents overrides 63 any pre-existing defaults, but not those in the given section. 64 65 The section DEFAULT is special. 59 66 """ 60 67 61 if self.has_option(section, option) or (vars and option in vars): 62 value = SafeConfigParser.get(self, section, option, vars=vars) 63 if value == 'None': 64 return default 65 elif value == 'True': 66 return True 67 elif value == 'False': 68 return False 69 else: 70 return value 68 # Reimplement parent behaviour, that uses `vars` to override even 69 # the value in the specific section... Overriding the defaults 70 # seems a better idea 71 72 d = self._defaults.copy() 73 # Update with the entry specific variables 74 if vars is not None: 75 d.update(vars) 76 try: 77 d.update(self._sections[section]) 78 except KeyError: 79 if section != DEFAULTSECT: 80 raise NoSectionError(section) 81 option = self.optionxform(option) 82 try: 83 value = d[option] 84 except KeyError: 85 value = default 86 87 if not raw: 88 value = self._interpolate(section, option, value, d) 89 90 if value == 'None': 91 return default 92 elif value == 'True': 93 return True 94 elif value == 'False': 95 return False 71 96 else: 72 return default97 return value 73 98 74 99 def getTuple(self, section, option, default=None):
Note: See TracChangeset
for help on using the changeset viewer.
