Fix translations for collections and drop useless try.
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sat, 27 Apr 2013 12:52:08 +0000 (14:52 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Sat, 27 Apr 2013 13:08:07 +0000 (15:08 +0200)
Don't do:  _("With some value: %s" % value)
Please do: _("WIth some value: %s") % value

Fixed for collection messages.

Also removed a
  try:
    some_code.
  except Exception as e:
    raise

No point in doing that.

Fixing the indentation of some_code comes in an extra
commit, because changing indentation is annoying enough
alone, so don't mix it with other changes.

mediagoblin/submit/views.py
mediagoblin/user_pages/views.py

index 9d31c8449545763967cf93296843344d9d8a6b9a..c9735fd366007ecd8f109f5fff2cc4500dac0125 100644 (file)
@@ -114,6 +114,7 @@ def submit_start(request):
         {'submit_form': submit_form,
          'app_config': mg_globals.app_config})
 
+
 @require_active_login
 def add_collection(request, media=None):
     """
@@ -122,7 +123,6 @@ 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)
@@ -136,19 +136,18 @@ def add_collection(request, media=None):
                     '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',
index e3b46c0f8787b41a0868d38f6d113727265d8456..21b0c01696d39e08fbfe94082635065df66ffb39 100644 (file)
@@ -409,8 +409,8 @@ def collection_confirm_delete(request, collection):
                 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)