{'submit_form': submit_form,
'app_config': mg_globals.app_config})
+
@require_active_login
def add_collection(request, media=None):
"""
submit_form = submit_forms.AddCollectionForm(request.form)
if request.method == 'POST' and submit_form.validate():
- try:
collection = request.db.Collection()
collection.title = unicode(submit_form.title.data)
'title':collection.title})
if existing_collection:
- messages.add_message(
- request, messages.ERROR, _('You already have a collection called "%s"!' % collection.title))
+ add_message(request, messages.ERROR,
+ _('You already have a collection called "%s"!') \
+ % collection.title)
else:
collection.save()
- add_message(request, SUCCESS, _('Collection "%s" added!' % collection.title))
+ add_message(request, SUCCESS,
+ _('Collection "%s" added!') % collection.title)
return redirect(request, "mediagoblin.user_pages.user_home",
user=request.user.username)
- except Exception as e:
- raise
-
return render_to_response(
request,
'mediagoblin/submit/collection.html',
item.delete()
collection.delete()
- messages.add_message(
- request, messages.SUCCESS, _('You deleted the collection "%s"' % collection_title))
+ messages.add_message(request, messages.SUCCESS,
+ _('You deleted the collection "%s"') % collection_title)
return redirect(request, "mediagoblin.user_pages.user_home",
user=username)