From 3038ba87e4fdc5612f57affeedb643a614e0c9a2 Mon Sep 17 00:00:00 2001 From: Manuel Urbano Santos Date: Sun, 27 Nov 2011 13:49:47 +0100 Subject: [PATCH] * Bug #671: Tags list on Edit page is not seperated by spaces and hard to read : Make 'media_tags_as_string' function put a space after each comma. * Feature #678: Drop custom delimiters in tags : I declare a constant in the begining of text.py file. --- mediagoblin/config_spec.ini | 1 - mediagoblin/tools/text.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini index eef6f6e0..544f0321 100644 --- a/mediagoblin/config_spec.ini +++ b/mediagoblin/config_spec.ini @@ -27,7 +27,6 @@ email_smtp_pass = string(default=None) allow_registration = boolean(default=True) # tag parsing -tags_delimiter = string(default=",") tags_max_length = integer(default=50) # Whether comments are ascending or descending diff --git a/mediagoblin/tools/text.py b/mediagoblin/tools/text.py index be1adb00..d576224d 100644 --- a/mediagoblin/tools/text.py +++ b/mediagoblin/tools/text.py @@ -43,6 +43,7 @@ HTML_CLEANER = Cleaner( host_whitelist=(), whitelist_tags=set([])) +TAGS_DELIMITER=','; def clean_html(html): # clean_html barfs on an empty string @@ -67,7 +68,7 @@ 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( - mg_globals.app_config['tags_delimiter']): + TAGS_DELIMITER): # Ignore empty or duplicate tags if tag.strip() and tag.strip() not in [t['name'] for t in taglist]: @@ -85,7 +86,7 @@ def media_tags_as_string(media_entry_tags): """ media_tag_string = '' if media_entry_tags: - media_tag_string = mg_globals.app_config['tags_delimiter'].join( + media_tag_string = (TAGS_DELIMITER+u' ').join( [tag['name'] for tag in media_entry_tags]) return media_tag_string -- 2.25.1