def __setattr__(self, name, value): # Names starting with an underscore are not preferences but normal # instance attributes if name.startswith('_'): MutableMapping.__setattr__(self, name, value) else: self._all_prefs[self._basename + '.' + name] = value
def __delattr__(self, name): if 'pref_register' in self.__dict__ and name in self.pref_register: raise PreferenceError('Cannot delete a preference category.') else: MutableMapping.__setattr__(self, name, value)
def __setattr__(self, name, value): # Do not allow to set a category name to something else if 'pref_register' in self.__dict__ and name in self.pref_register: raise PreferenceError('Cannot set a preference category.') else: MutableMapping.__setattr__(self, name, value)