diff options
Diffstat (limited to 'mediagoblin/processing/__init__.py')
-rw-r--r-- | mediagoblin/processing/__init__.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py index 361a9736..102fd5de 100644 --- a/mediagoblin/processing/__init__.py +++ b/mediagoblin/processing/__init__.py @@ -14,7 +14,13 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from collections import OrderedDict +# Use an ordered dict if we can. If not, we'll just use a normal dict +# later. +try: + from collections import OrderedDict +except: + OrderedDict = None + import logging import os @@ -187,7 +193,10 @@ class ProcessingManager(object): """ def __init__(self): # Dict of all MediaProcessors of this media type - self.processors = OrderedDict() + if OrderedDict is not None: + self.processors = OrderedDict() + else: + self.processors = {} def add_processor(self, processor): """ @@ -237,8 +246,6 @@ class ProcessingManager(object): try: processor = self.processors[key] except KeyError: - import pdb - pdb.set_trace() raise ProcessorDoesNotExist( "'%s' processor does not exist for this media type" % key) @@ -376,8 +383,7 @@ def store_public(entry, keyname, local_file, target_name=None, raise PublicStoreFail(keyname=keyname) # raise an error if the file failed to copy - copied_filepath = mgg.public_store.get_local_path(target_filepath) - if not os.path.exists(copied_filepath): + if not mgg.public_store.file_exists(target_filepath): raise PublicStoreFail(keyname=keyname) entry.media_files[keyname] = target_filepath @@ -393,7 +399,7 @@ class BaseProcessingFail(Exception): subclass from. You shouldn't call this itself; instead you should subclass it - and provid the exception_path and general_message applicable to + and provide the exception_path and general_message applicable to this error. """ general_message = u'' |