From bda3405342feb7f239ccaa2e7cebe76a48909309 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 18 Jul 2010 15:21:51 -0500 Subject: [PATCH] Still totally useless but at least it writes to the database --- mediagoblin/app.py | 2 +- mediagoblin/templates/mediagoblin/test_submit.html | 3 ++- mediagoblin/views.py | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 7231b786..ef4feae3 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -64,7 +64,7 @@ class MediagoblinApp(object): def paste_app_factory(global_config, **kw): connection = pymongo.Connection() - db = kw.get('db_name', 'mediagoblin') + db = connection[kw.get('db_name', 'mediagoblin')] return MediagoblinApp( db, diff --git a/mediagoblin/templates/mediagoblin/test_submit.html b/mediagoblin/templates/mediagoblin/test_submit.html index 0d2fd258..bf91d26b 100644 --- a/mediagoblin/templates/mediagoblin/test_submit.html +++ b/mediagoblin/templates/mediagoblin/test_submit.html @@ -1,6 +1,7 @@ -
+ {% for field in image_form %} diff --git a/mediagoblin/views.py b/mediagoblin/views.py index ef0fddad..116237b7 100644 --- a/mediagoblin/views.py +++ b/mediagoblin/views.py @@ -1,3 +1,5 @@ +import datetime + from webob import Response, exc import wtforms @@ -17,7 +19,11 @@ def submit_test(request): image_form = ImageSubmitForm(request.POST) if request.method == 'POST' and image_form.validate(): # create entry and save in database - + work_id = request.app.db.works.insert( + {'title': image_form.title.data, + 'created': datetime.datetime.now(), + 'description': image_form.description.data}) + # save file to disk ## TODO -- 2.25.1