equal
deleted
inserted
replaced
82 |
82 |
83 Throws a `ConfigValueError` for all other values, except bools. |
83 Throws a `ConfigValueError` for all other values, except bools. |
84 """ |
84 """ |
85 if isinstance(value, bool): |
85 if isinstance(value, bool): |
86 return value |
86 return value |
87 if value.lower() in self._boolean_states: |
87 if value.lower() in self.BOOLEAN_STATES: |
88 return self._boolean_states[value.lower()] |
88 return self.BOOLEAN_STATES[value.lower()] |
89 else: |
89 else: |
90 raise ConfigValueError(_("Not a boolean: '%s'") % |
90 raise ConfigValueError(_("Not a boolean: '%s'") % |
91 get_unicode(value)) |
91 get_unicode(value)) |
92 |
92 |
93 def getboolean(self, section, option): |
93 def getboolean(self, section, option): |
102 """ |
102 """ |
103 # if the setting was modified it may be still a boolean value lets see |
103 # if the setting was modified it may be still a boolean value lets see |
104 tmp = self.get(section, option) |
104 tmp = self.get(section, option) |
105 if isinstance(tmp, bool): |
105 if isinstance(tmp, bool): |
106 return tmp |
106 return tmp |
107 if not tmp.lower() in self._boolean_states: |
107 if not tmp.lower() in self.BOOLEAN_STATES: |
108 raise ValueError('Not a boolean: %s' % tmp) |
108 raise ValueError('Not a boolean: %s' % tmp) |
109 return self._boolean_states[tmp.lower()] |
109 return self.BOOLEAN_STATES[tmp.lower()] |
110 |
110 |
111 def _get_section_option(self, section_option): |
111 def _get_section_option(self, section_option): |
112 """splits ``section_option`` (section.option) in two parts and |
112 """splits ``section_option`` (section.option) in two parts and |
113 returns them as list ``[section, option]``, if: |
113 returns them as list ``[section, option]``, if: |
114 |
114 |