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): def paste_app_factory(global_config, **kw):
connection = pymongo.Connection() connection = pymongo.Connection()
db = kw.get('db_name', 'mediagoblin') db = connection[kw.get('db_name', 'mediagoblin')]
return MediagoblinApp( return MediagoblinApp(
db, db,

View File

@ -1,6 +1,7 @@
<html> <html>
<body> <body>
<form action="{{ request.urlgen('test_submit') }}" method="POST"> <form action="{{ request.urlgen('test_submit') }}" method="POST"
enctype="multipart/form-data">
<table> <table>
{% for field in image_form %} {% for field in image_form %}
<tr> <tr>

View File

@ -1,3 +1,5 @@
import datetime
from webob import Response, exc from webob import Response, exc
import wtforms import wtforms
@ -17,7 +19,11 @@ def submit_test(request):
image_form = ImageSubmitForm(request.POST) image_form = ImageSubmitForm(request.POST)
if request.method == 'POST' and image_form.validate(): if request.method == 'POST' and image_form.validate():
# create entry and save in database # 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 # save file to disk
## TODO ## TODO