aboutsummaryrefslogtreecommitdiffstats
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
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!
-rw-r--r--mediagoblin/processing/__init__.py1
-rw-r--r--mediagoblin/processing/task.py10
2 files changed, 7 insertions, 4 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
index 02dba2f9..47f0b84e 100644
--- a/mediagoblin/processing/__init__.py
+++ b/mediagoblin/processing/__init__.py
@@ -116,6 +116,7 @@ class MediaProcessor(object):
def __init__(self, manager, media_entry):
self.manager = manager
self.media_entry = media_entry
+ self.entry_orig_state = media_entry.state
# Should be initialized at time of processing, at least
self.workbench = None
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