def contains(self, key, defaults=True): key = self.optionxform(key) if ProductSetting.exists(self.env, self.product, self.name, key): return True for parent in self.config.parents: if parent[self.name].contains(key, defaults=False): return True return defaults and (self.name, key) in Option.registry
def contains(self, key, defaults=True): key = self.optionxform(key) if ProductSetting.exists(self.env, self.product, self.name, key): return True for parent in self.config.parents: if parent[self.name].contains(key, defaults=False): return True return defaults and Option.registry.has_key((self.name, key))
def has_option(self, section, option, defaults=True): """Returns True if option exists in section in either the project trac.ini or one of the parents, or is available through the Option registry. (since Trac 0.11) """ if ProductSetting.exists(self.env, self.product, section, option): return True for parent in self.parents: if parent.has_option(section, option, defaults=False): return True return defaults and (section, option) in Option.registry
def has_option(self, section, option, defaults=True): """Returns True if option exists in section in either the project trac.ini or one of the parents, or is available through the Option registry. (since Trac 0.11) """ if ProductSetting.exists(self.env, self.product, section, option): return True for parent in self.parents: if parent.has_option(section, option, defaults=False): return True return defaults and (section, option) in Option.registry
def set_defaults(self, compmgr=None): """Retrieve all default values and store them explicitly in the configuration, so that they can be saved to file. Values already set in the configuration are not overridden. """ for section, default_options in self.defaults(compmgr).items(): for name, value in default_options.items(): if not ProductSetting.exists(self.env, self.product, section, name): if any(parent[section].contains(name, defaults=False) for parent in self.parents): value = None self.set(section, name, value)
def set_defaults(self, compmgr=None): """Retrieve all default values and store them explicitly in the configuration, so that they can be saved to file. Values already set in the configuration are not overridden. """ for section, default_options in self.defaults(compmgr).items(): for name, value in default_options.items(): if not ProductSetting.exists(self.env, self.product, section, name): if any(parent[section].contains(name, defaults=False) for parent in self.parents): value = None self.set(section, name, value)