diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-05-21 00:28:37 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-05-21 00:28:37 +0200 |
commit | 6c1467d570a4da68ef8b4edac9aecdb9c87a61de (patch) | |
tree | 00788a32b50738c701fd5150e773204e389bd5a2 /mediagoblin/plugins | |
parent | 4adc3a85dda878b40f44e07b2283d4c55c6c5d02 (diff) | |
download | mediagoblin-6c1467d570a4da68ef8b4edac9aecdb9c87a61de.tar.lz mediagoblin-6c1467d570a4da68ef8b4edac9aecdb9c87a61de.tar.xz mediagoblin-6c1467d570a4da68ef8b4edac9aecdb9c87a61de.zip |
Refactor submit util new_upload_entry
This tool creates an initial media entry for a given user.
No magic. It just prefills the license with the user's
default license and adds the user as uploader.
Diffstat (limited to 'mediagoblin/plugins')
-rw-r--r-- | mediagoblin/plugins/api/views.py | 6 | ||||
-rw-r--r-- | mediagoblin/plugins/piwigo/views.py | 8 |
2 files changed, 4 insertions, 10 deletions
diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py index fde76fe4..9159fe65 100644 --- a/mediagoblin/plugins/api/views.py +++ b/mediagoblin/plugins/api/views.py @@ -27,7 +27,7 @@ from mediagoblin.media_types import sniff_media from mediagoblin.plugins.api.tools import api_auth, get_entry_serializable, \ json_response from mediagoblin.submit.lib import check_file_field, prepare_queue_task, \ - run_process_media + run_process_media, new_upload_entry _log = logging.getLogger(__name__) @@ -53,7 +53,7 @@ def post_entry(request): media_type, media_manager = sniff_media(media_file) - entry = request.db.MediaEntry() + entry = new_upload_entry(request.user) entry.media_type = unicode(media_type) entry.title = unicode(request.form.get('title') or splitext(media_file.filename)[0]) @@ -61,8 +61,6 @@ def post_entry(request): entry.description = unicode(request.form.get('description')) entry.license = unicode(request.form.get('license', '')) - entry.uploader = request.user.id - entry.generate_slug() # queue appropriately diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py index 1c655bf5..bd6b1012 100644 --- a/mediagoblin/plugins/piwigo/views.py +++ b/mediagoblin/plugins/piwigo/views.py @@ -26,7 +26,7 @@ from mediagoblin.meddleware.csrf import csrf_exempt from mediagoblin.auth.lib import fake_login_attempt from mediagoblin.media_types import sniff_media from mediagoblin.submit.lib import check_file_field, prepare_queue_task, \ - run_process_media + run_process_media, new_upload_entry from .tools import CmdTable, response_xml, check_form, \ PWGSession, PwgNamedArray, PwgError @@ -124,7 +124,7 @@ def pwg_images_addSimple(request): request.files['image']) # create entry and save in database - entry = request.db.MediaEntry() + entry = new_upload_entry(request.user) entry.media_type = unicode(media_type) entry.title = ( unicode(form.name.data) @@ -132,10 +132,6 @@ def pwg_images_addSimple(request): entry.description = unicode(form.comment.data) - # entry.license = unicode(form.license.data) or None - - entry.uploader = request.user.id - ''' # Process the user's folksonomy "tags" entry.tags = convert_to_tag_list_of_dicts( |