aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/processing/task.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-08-12 08:22:14 -0500
committerRodney Ewing <ewing.rj@gmail.com>2013-08-16 15:30:16 -0700
commit22479c39a0fff75208309e437f5fdaf57730cf0e (patch)
tree8bd05d53ddf7add0d0965155164a83a53eabc432 /mediagoblin/processing/task.py
parent2fa7b7f81a308210e6f7a6556df18e24466732af (diff)
downloadmediagoblin-22479c39a0fff75208309e437f5fdaf57730cf0e.tar.lz
mediagoblin-22479c39a0fff75208309e437f5fdaf57730cf0e.tar.xz
mediagoblin-22479c39a0fff75208309e437f5fdaf57730cf0e.zip
Record the original state of the media entry in the processor
This allows our processor to make some informed decisions based on the state by still having access to the original state. This commit sponsored by William Rico. Thank you!
Diffstat (limited to 'mediagoblin/processing/task.py')
-rw-r--r--mediagoblin/processing/task.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py
index 397514d0..d3770588 100644
--- a/mediagoblin/processing/task.py
+++ b/mediagoblin/processing/task.py
@@ -85,12 +85,14 @@ class ProcessMedia(task.Task):
try:
processor_class = manager.get_processor(reprocess_action, entry)
- entry.state = u'processing'
- entry.save()
+ with processor_class(manager, entry) as processor:
+ # Initial state change has to be here because
+ # the entry.state gets recorded on processor_class init
+ entry.state = u'processing'
+ entry.save()
- _log.debug('Processing {0}'.format(entry))
+ _log.debug('Processing {0}'.format(entry))
- with processor_class(manager, entry) as processor:
processor.process(**reprocess_info)
# We set the state to processed and save the entry here so there's