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 addValue(self, key, value, position): try: realkey = self.type.keytype(key) except ValueError as e: raise_with_same_tb(ZConfig.DataConversionError(e, key, position)) if realkey in self.optionbag: return ZConfig.matcher.BaseMatcher.addValue(self, key, value, position)
def addValue(self, key, value, position): try: realkey = self.type.keytype(key) except ValueError as e: raise_with_same_tb(ZConfig.DataConversionError(e, key, position)) if realkey in self.optionbag: return ZConfig.matcher.BaseMatcher.addValue(self, key, value, position)
def _raise_open_error(self, url, message): if url[:7].lower() == "file://": what = "file" ident = urllib2.url2pathname(url[7:]) else: what = "URL" ident = url error = ZConfig.ConfigurationError( "error opening %s %s: %s" % (what, ident, message), url) raise_with_same_tb(error)
def _raise_open_error(self, url, message): if url[:7].lower() == "file://": what = "file" ident = urllib2.url2pathname(url[7:]) else: what = "URL" ident = url error = ZConfig.ConfigurationError( "error opening %s %s: %s" % (what, ident, message), url) raise_with_same_tb(error)
def constuct(self): values = self._values for name, ci in self.type: assert ci.attribute is not None attr = ci.attribute if ci.ismulti(): if ci.issection(): v = [] for s in values[attr]: if s is not None: st = s.getSectionDefinition() try: s = st.datatype(s) except ValueError as e: raise_with_same_tb( ZConfig.DataConversionError( e, s, (-1, -1, None))) v.append(s) elif ci.name == '+': v = values[attr] for key, val in v.items(): v[key] = [vi.convert(ci.datatype) for vi in val] else: v = [vi.convert(ci.datatype) for vi in values[attr]] elif ci.issection(): if values[attr] is not None: st = values[attr].getSectionDefinition() try: v = st.datatype(values[attr]) except ValueError as e: raise_with_same_tb( ZConfig.DataConversionError( e, values[attr], (-1, -1, None))) else: v = None elif name == '+': v = values[attr] if not v: for key, val in ci.getdefault().items(): v[key] = val.convert(ci.datatype) else: for key, val in v.items(): v[key] = val.convert(ci.datatype) else: v = values[attr] if v is not None: v = v.convert(ci.datatype) values[attr] = v if ci.handler is not None: self.handlers.append((ci.handler, v)) return self.createValue()
def constuct(self): values = self._values for name, ci in self.type: assert ci.attribute is not None attr = ci.attribute if ci.ismulti(): if ci.issection(): v = [] for s in values[attr]: if s is not None: st = s.getSectionDefinition() try: s = st.datatype(s) except ValueError as e: raise_with_same_tb(ZConfig.DataConversionError( e, s, (-1, -1, None))) v.append(s) elif ci.name == '+': v = values[attr] for key, val in v.items(): v[key] = [vi.convert(ci.datatype) for vi in val] else: v = [vi.convert(ci.datatype) for vi in values[attr]] elif ci.issection(): if values[attr] is not None: st = values[attr].getSectionDefinition() try: v = st.datatype(values[attr]) except ValueError as e: raise_with_same_tb(ZConfig.DataConversionError( e, values[attr], (-1, -1, None))) else: v = None elif name == '+': v = values[attr] if not v: for key, val in ci.getdefault().items(): v[key] = val.convert(ci.datatype) else: for key, val in v.items(): v[key] = val.convert(ci.datatype) else: v = values[attr] if v is not None: v = v.convert(ci.datatype) values[attr] = v if ci.handler is not None: self.handlers.append((ci.handler, v)) return self.createValue()
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 error(self, message): raise_with_same_tb( ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno))
def error(self, message): raise_with_same_tb(self.initerror(ZConfig.SchemaError(message)))
def error(self, message, kind=None): # Can't do this as a default value because of import order kind = kind or ZConfig.SchemaError raise_with_same_tb(self.initerror(kind(message)))
def error(self, message): raise_with_same_tb(self.initerror(ZConfig.SchemaError(message)))
def error(self, message): raise_with_same_tb( ZConfig.ConfigurationSyntaxError( message, self.url, self.lineno))