Still totally useless but at least it writes to the database

This commit is contained in:
Christopher Allan Webber 2010-07-18 15:21:51 -05:00
parent fbf7880e68
commit bda3405342
3 changed files with 10 additions and 3 deletions

View File

@ -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,

View File

@ -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>

View File

@ -1,3 +1,5 @@
import datetime
from webob import Response, exc
import wtforms
@ -17,6 +19,10 @@ 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