displays the tags on edit correctly now
authorCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 13 Jul 2011 01:43:16 +0000 (20:43 -0500)
committerCaleb Forbes Davis V <caldavis@gmail.com>
Wed, 13 Jul 2011 01:43:16 +0000 (20:43 -0500)
-before it was running the tags field through the submit filter.
 that was kind of dumb
-removes the filter function from the edit form
-adds unicode syntax in the filter function
-uses split correctly when saving the edited tags to mongodb

mediagoblin/edit/forms.py
mediagoblin/edit/views.py
mediagoblin/util.py

index 5e3aab96159b3a287aa9b4493ad4995ab52eded7..e13cfaa9e736796efdcdc5d8a24b2b10f58179af 100644 (file)
@@ -27,7 +27,7 @@ class EditForm(wtforms.Form):
     slug = wtforms.TextField(
         'Slug')
     description = wtforms.TextAreaField('Description of this work')
-    tags = wtforms.TextField('Tags', filters=[convert_to_tag_list])
+    tags = wtforms.TextField('Tags')
 
 class EditProfileForm(wtforms.Form):
     bio = wtforms.TextAreaField('Bio',
index f5e7f454fe2a2ba3d379596614b71f8f7a2c9f95..0c4fd7351f57b7eb4cd7bd8242db71e4f1a32e09 100644 (file)
@@ -62,7 +62,7 @@ def edit_media(request, media):
                     media['description']))
 
             media['slug'] = request.POST['slug']
-            media['tags'] = split(request.POST['tags'])
+            media['tags'] = request.POST['tags'].split(TAGS_DELIMITER)
             media.save()
 
             return redirect(request, "mediagoblin.user_pages.media_home",
index 7ee0a2d5e9c209ee369cbde9ae004efc1bdae00d..4421bec4436b8b6e1b011a250899e97cc29c78b7 100644 (file)
@@ -370,7 +370,7 @@ def clean_html(html):
     return HTML_CLEANER.clean_html(html)
 
 
-TAGS_DELIMITER = ' '
+TAGS_DELIMITER = u' '
 
 def convert_to_tag_list(tag_string):
     """
@@ -381,7 +381,7 @@ def convert_to_tag_list(tag_string):
     """
     if tag_string:
         taglist = []
-        stripped_tag_string = ' '.join(tag_string.strip().split())
+        stripped_tag_string = u' '.join(tag_string.strip().split())
         for tag in stripped_tag_string.split(TAGS_DELIMITER):
             if tag.strip(): taglist.append(tag.strip())
         return taglist