def basic_key(self, s, pos): try: return self._basic_key(s) except ValueError as e: raise_with_same_tb( ZConfig.ConfigurationSyntaxError( "could not convert basic-key value: " + str(e), *pos))
def addOption(self, spec, pos=None): """Add a single value to the list of overridden values. The *spec* argument is a value specifier string of the form ``optionpath=value``. For example:: some/path/to/key=value The *optionpath* specifies the "full path" to the configuration setting: it can contain a sequence of names, separated by ``/`` characters. Each name before the last names a section from the configuration file, and the last name corresponds to a key within the section identified by the leading section names. If *optionpath* contains only one name, it identifies a key in the top-level schema. *value* is a string that will be treated just like a value in the configuration file. A source position for the specifier may be given as *pos*. If *pos* is specified and not ``None``, it must be a sequence of three values. The first is the URL of the source (or some other identifying string). The second and third are the line number and column of the setting. These position information is only used to construct a :exc:`~.DataConversionError` when data conversion fails. """ if pos is None: pos = "<command-line option>", -1, -1 if "=" not in spec: e = ZConfig.ConfigurationSyntaxError( "invalid configuration specifier", *pos) e.specifier = spec raise e # For now, just add it to the list; not clear that checking # against the schema at this point buys anything. opt, val = spec.split("=", 1) optpath = opt.split("/") if "" in optpath: # // is not allowed in option path e = ZConfig.ConfigurationSyntaxError( "'//' is not allowed in an option path", *pos) e.specifier = spec raise e self.clopts.append((optpath, val, pos))
def addOption(self, spec, pos=None): if pos is None: pos = "<command-line option>", -1, -1 if "=" not in spec: e = ZConfig.ConfigurationSyntaxError( "invalid configuration specifier", *pos) e.specifier = spec raise e # For now, just add it to the list; not clear that checking # against the schema at this point buys anything. opt, val = spec.split("=", 1) optpath = opt.split("/") if "" in optpath: # // is not allowed in option path e = ZConfig.ConfigurationSyntaxError( "'//' is not allowed in an option path", *pos) e.specifier = spec raise e self.clopts.append((optpath, val, pos))
def basic_key(self, s, pos): try: return self._basic_key(s) except ValueError: raise ZConfig.ConfigurationSyntaxError( "could not convert basic-key value", *pos)
def error(self, message): raise ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno)
def error(self, message): raise_with_same_tb( ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno))