diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-10 19:53:37 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-10 19:53:37 -0500 |
commit | 852d5bb2387706c11925fa0c2abe4a1f34708f16 (patch) | |
tree | df5e6a3108d2ba007112b558ff65bbfabd88020c /mediagoblin/submit | |
parent | 6b9ee0ca13b99ee20f9d0c680a950c6a7494a5a0 (diff) | |
parent | 6d794f268bb1f5d3cc56c5f0dc902571d48ebeac (diff) | |
download | mediagoblin-852d5bb2387706c11925fa0c2abe4a1f34708f16.tar.lz mediagoblin-852d5bb2387706c11925fa0c2abe4a1f34708f16.tar.xz mediagoblin-852d5bb2387706c11925fa0c2abe4a1f34708f16.zip |
Merge branch 'master' into processing
Diffstat (limited to 'mediagoblin/submit')
-rw-r--r-- | mediagoblin/submit/__init__.py | 17 | ||||
-rw-r--r-- | mediagoblin/submit/forms.py | 10 | ||||
-rw-r--r-- | mediagoblin/submit/views.py | 15 |
3 files changed, 36 insertions, 6 deletions
diff --git a/mediagoblin/submit/__init__.py b/mediagoblin/submit/__init__.py index e69de29b..a8eeb5ed 100644 --- a/mediagoblin/submit/__init__.py +++ b/mediagoblin/submit/__init__.py @@ -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/>. + + diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py index 3fd9ea49..241d32dc 100644 --- a/mediagoblin/submit/forms.py +++ b/mediagoblin/submit/forms.py @@ -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]) diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index f19bf22e..59d8fe3f 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -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']) |