peerdb/tripe-newpeers.in: Sort the output so that testing is easier.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 2 May 2015 16:05:20 +0000 (17:05 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2015 18:26:46 +0000 (19:26 +0100)
peerdb/tripe-newpeers.in

index aa9ccfc..d22aff7 100644 (file)
@@ -303,7 +303,7 @@ def output(conf, cdb):
   This is where the special `user' and `auto' database entries get set.
   """
   auto = []
-  for sec in conf.sections():
+  for sec in sorted(conf.sections()):
     if sec.startswith('@'):
       continue
     elif sec.startswith('$'):
@@ -316,7 +316,7 @@ def output(conf, cdb):
       if conf.has_option(sec, 'user'):
         cdb.add('U%s' % conf.get(sec, 'user'), sec)
     url = M.URLEncode(laxp = True, semip = True)
-    for key, value in conf.items(sec):
+    for key, value in sorted(conf.items(sec), key = lambda (k, v): k):
       if not key.startswith('@'):
         url.encode(key, ' '.join(M.split(value)[0]))
     cdb.add(label, url.result)