Mercurial > p > roundup > code
comparison roundup/configuration.py @ 5128:4058fc1ec746
replacing depricated has_key references by in to support python 3. Errors reported by python -3 roundup_server. Unit tests test_config test_security pass although test_config is a bit weak in coverage.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 04 Jul 2016 15:14:54 -0400 |
| parents | 14abd0a67207 |
| children | 7aebd892b600 |
comparison
equal
deleted
inserted
replaced
| 5127:425b4c4fc345 | 5128:4058fc1ec746 |
|---|---|
| 1006 Note: aliases should only exist in historical options | 1006 Note: aliases should only exist in historical options |
| 1007 for backwards compatibility - new options should | 1007 for backwards compatibility - new options should |
| 1008 *not* have aliases! | 1008 *not* have aliases! |
| 1009 | 1009 |
| 1010 """ | 1010 """ |
| 1011 if description or not self.section_descriptions.has_key(section): | 1011 if description or not (section in self.section_descriptions): |
| 1012 self.section_descriptions[section] = description | 1012 self.section_descriptions[section] = description |
| 1013 for option_def in options: | 1013 for option_def in options: |
| 1014 klass = option_def[0] | 1014 klass = option_def[0] |
| 1015 args = option_def[1:] | 1015 args = option_def[1:] |
| 1016 option = klass(self, section, *args) | 1016 option = klass(self, section, *args) |
| 1325 # the values returned from this method: Option instances or config values? | 1325 # the values returned from this method: Option instances or config values? |
| 1326 | 1326 |
| 1327 # attribute emulation | 1327 # attribute emulation |
| 1328 | 1328 |
| 1329 def __setattr__(self, name, value): | 1329 def __setattr__(self, name, value): |
| 1330 if self.__dict__.has_key(name) or hasattr(self.__class__, name): | 1330 if (name in self.__dict__) or hasattr(self.__class__, name): |
| 1331 self.__dict__[name] = value | 1331 self.__dict__[name] = value |
| 1332 else: | 1332 else: |
| 1333 self._get_option(name).set(value) | 1333 self._get_option(name).set(value) |
| 1334 | 1334 |
| 1335 # Note: __getattr__ is not symmetric to __setattr__: | 1335 # Note: __getattr__ is not symmetric to __setattr__: |
