From 955bf08255b6c282c24afcc56e3457d57eac98ed Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 2 Dec 2004 05:37:04 +0000 Subject: [PATCH] Rudimentary sorting. --- src/callbacks.py | 1 + src/conf.py | 1 + src/registry.py | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/callbacks.py b/src/callbacks.py index e08ffefc2..48585df9c 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -954,6 +954,7 @@ class CanonicalNameDict(utils.InsensitivePreservingDict): return canonicalName(s) class Disabled(registry.SpaceSeparatedListOf): + sorted = True Value = CanonicalString List = CanonicalNameSet diff --git a/src/conf.py b/src/conf.py index 04136a5a4..038f9a20e 100644 --- a/src/conf.py +++ b/src/conf.py @@ -231,6 +231,7 @@ class Servers(registry.SpaceSeparatedListOfStrings): L.append(s) class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf): + sorted = True List = ircutils.IrcSet Value = ValidChannel def removeChannel(self, channel): diff --git a/src/registry.py b/src/registry.py index bdf2d158e..ae1b5282b 100644 --- a/src/registry.py +++ b/src/registry.py @@ -571,6 +571,7 @@ class Regexp(Value): class SeparatedListOf(Value): List = list Value = Value + sorted = False def splitter(self, s): """Override this with a function that takes a string and returns a list of strings.""" @@ -592,6 +593,8 @@ class SeparatedListOf(Value): def __str__(self): values = self() + if self.sorted: + values = sorted(values) if values: return self.joiner(values) else: