Use WTForms data field in submit/views.py
authorHans Lo <hansshulo@gmail.com>
Thu, 28 Mar 2013 03:56:33 +0000 (23:56 -0400)
committerHans Lo <hansshulo@gmail.com>
Thu, 28 Mar 2013 03:56:33 +0000 (23:56 -0400)
mediagoblin/submit/views.py

index def7e839dbad3921c702e0c88beb63ab2aff1f7d..21aa8195ea65e53299ab6e2cf0caf5782fe223d8 100644 (file)
@@ -62,18 +62,18 @@ def submit_start(request):
                 entry = request.db.MediaEntry()
                 entry.media_type = unicode(media_type)
                 entry.title = (
-                    unicode(request.form['title'])
+                    unicode(submit_form.title.data)
                     or unicode(splitext(filename)[0]))
 
-                entry.description = unicode(request.form.get('description'))
+                entry.description = unicode(submit_form.description.data)
 
-                entry.license = unicode(request.form.get('license', "")) or None
+                entry.license = unicode(submit_form.license.data) or None
 
                 entry.uploader = request.user.id
 
                 # Process the user's folksonomy "tags"
                 entry.tags = convert_to_tag_list_of_dicts(
-                    request.form.get('tags'))
+                    submit_form.tags.data)
 
                 # Generate a slug from the title
                 entry.generate_slug()
@@ -127,8 +127,8 @@ def add_collection(request, media=None):
         try:
             collection = request.db.Collection()
 
-            collection.title = unicode(request.form['title'])
-            collection.description = unicode(request.form.get('description'))
+            collection.title = unicode(submit_form.title.data)
+            collection.description = unicode(submit_form.description.data)
             collection.creator = request.user.id
             collection.generate_slug()