diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-09-30 18:37:07 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-09-30 18:37:07 +0200 |
commit | b8e538e848b7d89e089ec431002cee0311ee25a6 (patch) | |
tree | a222a41076348dd387367dcc3b17b4a8706c5b8a /alot | |
parent | 04feeb96a2b5d6eeabc8dfa4eecb4c3d99120ac2 (diff) |
Add helper function to sort translated tags
Sorting tags using this function puts all tags of length 1 at the
beginning. This groups all tags mapped to unicode characters.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/helper.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/alot/helper.py b/alot/helper.py index aa5c7953..95c7f06a 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -212,3 +212,13 @@ def shell_quote(text): 'hello'"'"'there' ''' return "'%s'" % text.replace("'", """'"'"'""") + +def tag_cmp(a, b): + r''' + Sorting tags using this function puts all tags of length 1 at the + beginning. This groups all tags mapped to unicode characters. + ''' + if min(len(a), len(b)) == 1: + return cmp(len(a), len(b)) + else: + return cmp(a, b) |