diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-02 08:02:14 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-16 15:30:14 -0700 |
commit | 273c79513d82b03b99035dcfa47e839c61322483 (patch) | |
tree | 846bcd154c0347bdfce19735c99e16944650f282 | |
parent | 663b378b25228e81eb654a7f42e80be7e3d2907e (diff) | |
download | mediagoblin-273c79513d82b03b99035dcfa47e839c61322483.tar.lz mediagoblin-273c79513d82b03b99035dcfa47e839c61322483.tar.xz mediagoblin-273c79513d82b03b99035dcfa47e839c61322483.zip |
added a check_eligible function to image reprocessing
-rw-r--r-- | mediagoblin/media_types/image/__init__.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/mediagoblin/media_types/image/__init__.py b/mediagoblin/media_types/image/__init__.py index 2ad76111..a1b43479 100644 --- a/mediagoblin/media_types/image/__init__.py +++ b/mediagoblin/media_types/image/__init__.py @@ -90,9 +90,27 @@ def _parser(args): return parser.parse_args(args[1]) +def _check_eligible(entry_args, reprocess_args): + if entry_args.state == 'processed': + if reprocess_args.initial_processing: + raise Exception(_('You can not run --initial_processing on media' + ' that has already been processed.')) + + if entry_args.state == 'failed': + if reprocess_args.resize: + raise Exception(_('You can not run --resize on media that has not' + 'been processed.')) + + if entry_args.state == 'processing': + raise Exception(_('We currently do not support reprocessing on media' + 'that is in the "processing" state.')) + + def media_reprocess(args): reprocess_args = _parser(args) - args = args[0] + entry_args = args[0] + + _check_eligible(entry_args, reprocess_args) import ipdb ipdb.set_trace() |