aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/reprocess.py
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-08-01 13:51:36 -0700
committerRodney Ewing <ewing.rj@gmail.com>2013-08-16 15:30:13 -0700
commit81d880b16adb2d6c872e0ad37ffe34bf7bfaba6c (patch)
tree69b7163c84fc3963b03d06f3e2160a8be3cddcf1 /mediagoblin/gmg_commands/reprocess.py
parent7c1f6a6aeea47c27a56e3f39e0a6cf33d9dd2486 (diff)
downloadmediagoblin-81d880b16adb2d6c872e0ad37ffe34bf7bfaba6c.tar.lz
mediagoblin-81d880b16adb2d6c872e0ad37ffe34bf7bfaba6c.tar.xz
mediagoblin-81d880b16adb2d6c872e0ad37ffe34bf7bfaba6c.zip
Just raise standard exception. Pass print statement to gettext
Diffstat (limited to 'mediagoblin/gmg_commands/reprocess.py')
-rw-r--r--mediagoblin/gmg_commands/reprocess.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/mediagoblin/gmg_commands/reprocess.py b/mediagoblin/gmg_commands/reprocess.py
index 50434bd2..2158d36e 100644
--- a/mediagoblin/gmg_commands/reprocess.py
+++ b/mediagoblin/gmg_commands/reprocess.py
@@ -41,13 +41,6 @@ def reprocess_parser_setup(subparser):
help="The media_entry id(s) you wish to reprocess.")
-class MismatchingMediaTypes(Exception):
- """
- Error that should be raised if the media_types are not the same
- """
- pass
-
-
def _set_media_type(args):
if len(args[0].media_id) == 1:
media_type = MediaEntry.query.filter_by(id=args[0].media_id[0])\
@@ -56,9 +49,8 @@ def _set_media_type(args):
if not args[0].type:
args[0].type = media_type
elif args[0].type != media_type:
- raise MismatchingMediaTypes(_('The type that you set does not'
- ' match the type of the given'
- ' media_id.'))
+ raise Exception(_('The type that you set does not match the type'
+ ' of the given media_id.'))
elif len(args[0].media_id) > 1:
media_types = []
@@ -67,27 +59,26 @@ def _set_media_type(args):
.media_type.split('.')[-1])
for type in media_types:
if media_types[0] != type:
- raise MismatchingMediaTypes((u'You cannot reprocess different'
- ' media_types at the same time.'))
+ raise Exception((u'You cannot reprocess different media_types'
+ ' at the same time.'))
if not args[0].type:
args[0].type = media_types[0]
elif args[0].type != media_types[0]:
- raise MismatchingMediaTypes(_('The type that you set does not'
- ' match the type of the given'
- ' media_ids.'))
+ raise Exception(_('The type that you set does not match the type'
+ ' of the given media_ids.'))
elif not args[0].type:
- raise MismatchingMediaTypes(_('You must provide either a media_id or'
- ' set the --type flag'))
+ raise Exception(_('You must provide either a media_id or set the'
+ ' --type flag'))
def _reprocess_all(args):
if not args[0].type:
if args[0].state == 'failed':
if args[0].available:
- print '\n Available reprocess actions for all failed' \
- ' media_entries: \n \t --initial_processing'
+ print _('\n Available reprocess actions for all failed' \
+ ' media_entries: \n \t --initial_processing')
return
else:
#TODO reprocess all failed entries