Merge branch 'master' into processing

This commit is contained in:
Christopher Allan Webber
2011-08-10 19:53:37 -05:00
119 changed files with 5327 additions and 1171 deletions

View File

@@ -0,0 +1,17 @@
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011 Free Software Foundation, Inc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@@ -17,10 +17,16 @@
import wtforms
from mediagoblin.util import tag_length_validator
from mediagoblin.util import fake_ugettext_passthrough as _
class SubmitStartForm(wtforms.Form):
title = wtforms.TextField(
'Title',
_('Title'),
[wtforms.validators.Length(min=0, max=500)])
description = wtforms.TextAreaField('Description of this work')
file = wtforms.FileField('File')
file = wtforms.FileField(_('File'))
tags = wtforms.TextField(
_('Tags'),
[tag_length_validator])

View File

@@ -16,11 +16,14 @@
from os.path import splitext
from cgi import FieldStorage
from string import split
from werkzeug.utils import secure_filename
from mediagoblin.util import (
render_to_response, redirect, cleaned_markdown_conversion)
render_to_response, redirect, cleaned_markdown_conversion, \
convert_to_tag_list_of_dicts)
from mediagoblin.util import pass_to_ugettext as _
from mediagoblin.decorators import require_active_login
from mediagoblin.submit import forms as submit_forms, security
from mediagoblin.process_media import process_media_initial
@@ -39,10 +42,10 @@ def submit_start(request):
and isinstance(request.POST['file'], FieldStorage)
and request.POST['file'].file):
submit_form.file.errors.append(
u'You must provide a file.')
_(u'You must provide a file.'))
elif not security.check_filetype(request.POST['file']):
submit_form.file.errors.append(
u'The file doesn\'t seem to be an image!')
_(u"The file doesn't seem to be an image!"))
else:
filename = request.POST['file'].filename
@@ -59,6 +62,10 @@ def submit_start(request):
entry['media_type'] = u'image' # heh
entry['uploader'] = request.user['_id']
# Process the user's folksonomy "tags"
entry['tags'] = convert_to_tag_list_of_dicts(
request.POST.get('tags'))
# Save, just so we can get the entry id for the sake of using
# it to generate the file path
entry.save(validate=False)
@@ -87,7 +94,7 @@ def submit_start(request):
result = process_media_initial.delay(unicode(entry['_id']))
entry['queued_task_id'] = result.task_id
add_message(request, SUCCESS, 'Woohoo! Submitted!')
add_message(request, SUCCESS, _('Woohoo! Submitted!'))
return redirect(request, "mediagoblin.user_pages.user_home",
user = request.user['username'])