aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r--mediagoblin/submit/views.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 02026f45..b52fca33 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -29,7 +29,6 @@ _log = logging.getLogger(__name__)
from werkzeug.utils import secure_filename
from werkzeug.datastructures import FileStorage
-from mediagoblin.db.util import ObjectId
from mediagoblin.tools.text import convert_to_tag_list_of_dicts
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.response import render_to_response, redirect
@@ -66,7 +65,6 @@ def submit_start(request):
# create entry and save in database
entry = request.db.MediaEntry()
- entry.id = ObjectId()
entry.media_type = unicode(media_type)
entry.title = (
unicode(request.form['title'])
@@ -76,7 +74,7 @@ def submit_start(request):
entry.license = unicode(request.form.get('license', "")) or None
- entry.uploader = request.user._id
+ entry.uploader = request.user.id
# Process the user's folksonomy "tags"
entry.tags = convert_to_tag_list_of_dicts(
@@ -112,7 +110,7 @@ def submit_start(request):
entry.queued_task_id = task_id
# Save now so we have this data before kicking off processing
- entry.save(validate=True)
+ entry.save()
# Pass off to processing
#
@@ -121,7 +119,7 @@ def submit_start(request):
process_media = registry.tasks[ProcessMedia.name]
try:
process_media.apply_async(
- [unicode(entry._id)], {},
+ [unicode(entry.id)], {},
task_id=task_id)
except BaseException as exc:
# The purpose of this section is because when running in "lazy"
@@ -132,7 +130,7 @@ def submit_start(request):
#
# ... not completely the diaper pattern because the
# exception is re-raised :)
- mark_entry_failed(entry._id, exc)
+ mark_entry_failed(entry.id, exc)
# re-raise the exception
raise
@@ -193,24 +191,22 @@ def add_collection(request, media=None):
if request.method == 'POST' and submit_form.validate():
try:
collection = request.db.Collection()
- collection.id = ObjectId()
collection.title = unicode(request.form['title'])
-
collection.description = unicode(request.form.get('description'))
- collection.creator = request.user._id
+ collection.creator = request.user.id
collection.generate_slug()
# Make sure this user isn't duplicating an existing collection
existing_collection = request.db.Collection.find_one({
- 'creator': request.user._id,
+ 'creator': request.user.id,
'title':collection.title})
if existing_collection:
messages.add_message(
request, messages.ERROR, _('You already have a collection called "%s"!' % collection.title))
else:
- collection.save(validate=True)
+ collection.save()
add_message(request, SUCCESS, _('Collection "%s" added!' % collection.title))