aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2010-07-18 15:21:51 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2010-07-18 15:21:51 -0500
commitbda3405342feb7f239ccaa2e7cebe76a48909309 (patch)
tree4350476d4c4989863d3b61d88590373d39fdbcb7
parentfbf7880e6873a541da5f45f90d9e0fd31119514a (diff)
downloadmediagoblin-bda3405342feb7f239ccaa2e7cebe76a48909309.tar.lz
mediagoblin-bda3405342feb7f239ccaa2e7cebe76a48909309.tar.xz
mediagoblin-bda3405342feb7f239ccaa2e7cebe76a48909309.zip
Still totally useless but at least it writes to the database
-rw-r--r--mediagoblin/app.py2
-rw-r--r--mediagoblin/templates/mediagoblin/test_submit.html3
-rw-r--r--mediagoblin/views.py8
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 @@
<html>
<body>
- <form action="{{ request.urlgen('test_submit') }}" method="POST">
+ <form action="{{ request.urlgen('test_submit') }}" method="POST"
+ enctype="multipart/form-data">
<table>
{% for field in image_form %}
<tr>
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