Merge remote branch 'remotes/manolinux/671_spaces_in_tag_list_edit'
* remotes/manolinux/671_spaces_in_tag_list_edit: * Feature #678: Drop custom delimiters in tags * Eliminate the definition of the tag delimiter for tests. * Remove a test that was related to custom tags delimiter. * Bug #671: Tags list on Edit page is not seperated by spaces and hard to read * Modify a test to include this space. * 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.
This commit is contained in:
commit
6603b30041
@ -28,7 +28,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
|
||||
|
@ -5,7 +5,6 @@ email_debug_mode = true
|
||||
db_name = __mediagoblin_tests__
|
||||
|
||||
# tag parsing
|
||||
tags_delimiter = ","
|
||||
tags_max_length = 50
|
||||
|
||||
# Celery shouldn't be set up by the application as it's setup via
|
||||
|
@ -39,11 +39,4 @@ def test_list_of_dicts_conversion(test_app):
|
||||
# Make sure converting the list of dicts to a string works
|
||||
assert text.media_tags_as_string([{'name': u'yin', 'slug': u'yin'},
|
||||
{'name': u'yang', 'slug': u'yang'}]) == \
|
||||
u'yin,yang'
|
||||
|
||||
# If the tag delimiter is a space then we expect different results
|
||||
mg_globals.app_config['tags_delimiter'] = u' '
|
||||
assert text.convert_to_tag_list_of_dicts('unicorn ceramic nazi') == [
|
||||
{'name': u'unicorn', 'slug': u'unicorn'},
|
||||
{'name': u'ceramic', 'slug': u'ceramic'},
|
||||
{'name': u'nazi', 'slug': u'nazi'}]
|
||||
u'yin, yang'
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user