diff options
author | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2012-11-16 13:18:37 +0100 |
---|---|---|
committer | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2012-11-16 13:18:37 +0100 |
commit | 9061383de260ec3ed2c551793d91ee672d9989e6 (patch) | |
tree | 6148941870ae166d78ff47aef455635c749e4b04 | |
parent | 2a6a3b8cce82ab0139f37a1ff8769e24593537b6 (diff) | |
download | mediagoblin-9061383de260ec3ed2c551793d91ee672d9989e6.tar.lz mediagoblin-9061383de260ec3ed2c551793d91ee672d9989e6.tar.xz mediagoblin-9061383de260ec3ed2c551793d91ee672d9989e6.zip |
No need to strip the tag 4 times
spaetz' rule: Don't do sth 4 times when once suffices.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
-rw-r--r-- | mediagoblin/tools/text.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mediagoblin/tools/text.py b/mediagoblin/tools/text.py index 24a4d282..96df49d2 100644 --- a/mediagoblin/tools/text.py +++ b/mediagoblin/tools/text.py @@ -68,12 +68,11 @@ def convert_to_tag_list_of_dicts(tag_string): # Split the tag string into a list of tags for tag in stripped_tag_string.split(','): - + tag = tag.strip() # Ignore empty or duplicate tags - if tag.strip() and tag.strip() not in [t['name'] for t in taglist]: - - taglist.append({'name': tag.strip(), - 'slug': url.slugify(tag.strip())}) + if tag and tag not in [t['name'] for t in taglist]: + taglist.append({'name': tag, + 'slug': url.slugify(tag)}) return taglist |