X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/fd1ba90c16c810381d3dd9a49322c7c6280d86fa..85341d9c32dad3dbb05208b84e9616786287f8ee:/peerdb/tripe-newpeers.in diff --git a/peerdb/tripe-newpeers.in b/peerdb/tripe-newpeers.in index 304d34ac..b8cf6810 100644 --- a/peerdb/tripe-newpeers.in +++ b/peerdb/tripe-newpeers.in @@ -287,9 +287,7 @@ class ConfigSection (object): def items(me, resolvep = True): """ - Return a list of (NAME, VALUE) items in this section. - - This extends the default method by handling the inheritance chain. + Yield a list of item names in the section. """ ## Initialize for a depth-first walk of the inheritance graph. @@ -308,12 +306,8 @@ class ConfigSection (object): if key == '@inherit': stack += value.replace(',', ' ').split() else: d[key] = None - ## Now collect the values for the known keys, one by one. - items = [] - for key in d: items.append((key, me.get(key, resolvep))) - ## And we're done. - return items + return d.iterkeys() class MyConfigParser (object): """ @@ -439,7 +433,8 @@ class MyConfigParser (object): resolve hostnames will fail! """ for sec in me.sections(): - for key, value in sec.items(resolvep = False): + for key in sec.items(): + value = sec.get(key, resolvep = False) for match in RX_RESOLVE.finditer(value): me._resolver.prepare(match.group(1)) me._resolver.run() @@ -525,9 +520,9 @@ def output(conf, cdb): except MissingKeyException: pass else: cdb.add('U%s' % u) url = M.URLEncode(laxp = True, semip = True) - for key, value in sorted(sec.items(), key = lambda (k, v): k): + for key in sorted(sec.items()): if not key.startswith('@'): - url.encode(key, ' '.join(M.split(value)[0])) + url.encode(key, ' '.join(M.split(sec.get(key))[0])) cdb.add(label, url.result) cdb.add('%AUTO', ' '.join(auto)) cdb.finish()