Rudimentary sorting.

This commit is contained in:
Jeremy Fincher 2004-12-02 05:37:04 +00:00
parent 3904672c2f
commit 955bf08255
3 changed files with 5 additions and 0 deletions

View File

@ -954,6 +954,7 @@ class CanonicalNameDict(utils.InsensitivePreservingDict):
return canonicalName(s)
class Disabled(registry.SpaceSeparatedListOf):
sorted = True
Value = CanonicalString
List = CanonicalNameSet

View File

@ -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):

View File

@ -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: