@wraps(controller)
def wrapper(request, *args, **kwargs):
media = MediaEntry.query.filter_by(
- id=request.matchdict['media_id'],
- state=u'processed').first()
+ id=request.matchdict['media_id']).first()
# Still no media? Okay, 404.
if not media:
return render_404(request)
@get_media_entry_by_id
@require_active_login
def edit_media(request, media):
+ # If media is not processed, return NotFound.
+ if not media.state == u'processed':
+ return render_404(request)
+
if not may_edit_media(request, media):
raise Forbidden("User may not edit this media")
@get_media_entry_by_id
@require_active_login
def edit_attachments(request, media):
+ # If media is not processed, return NotFound.
+ if not media.state == u'processed':
+ return render_404(request)
+
if mg_globals.app_config['allow_attachments']:
form = forms.EditAttachmentsForm()
@require_active_login
@get_media_entry_by_id
def edit_metadata(request, media):
+ # If media is not processed, return NotFound.
+ if not media.state == u'processed':
+ return render_404(request)
+
form = forms.EditMetaDataForm(request.form)
if request.method == "POST" and form.validate():
metadata_dict = dict([(row['identifier'],row['value'])
if not request.method == 'POST':
raise MethodNotAllowed()
+ # If media is not processed, return NotFound.
+ if not media.state == u'processed':
+ return render_404(request)
+
comment = request.db.TextComment()
comment.actor = request.user.id
comment.content = six.text_type(request.form['comment_content'])
def media_collect(request, media):
"""Add media to collection submission"""
+ # If media is not processed, return NotFound.
+ if not media.state == u'processed':
+ return render_404(request)
+
form = user_forms.MediaCollectForm(request.form)
# A user's own collections:
form.collection.query = Collection.query.filter_by(