aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/processing/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/processing/__init__.py')
-rw-r--r--mediagoblin/processing/__init__.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
index 102fd5de..aa8f1447 100644
--- a/mediagoblin/processing/__init__.py
+++ b/mediagoblin/processing/__init__.py
@@ -24,6 +24,8 @@ except:
import logging
import os
+import six
+
from mediagoblin import mg_globals as mgg
from mediagoblin.db.util import atomic_update
from mediagoblin.db.models import MediaEntry
@@ -46,7 +48,7 @@ class ProgressCallback(object):
def create_pub_filepath(entry, filename):
return mgg.public_store.get_unique_filepath(
['media_entries',
- unicode(entry.id),
+ six.text_type(entry.id),
filename])
@@ -307,8 +309,8 @@ def mark_entry_failed(entry_id, exc):
store extra information that can be useful for users telling them
why their media failed to process.
- Args:
- - entry_id: The id of the media entry
+ :param entry_id: The id of the media entry
+ :param exc: An instance of BaseProcessingFail
"""
# Was this a BaseProcessingFail? In other words, was this a
@@ -319,7 +321,7 @@ def mark_entry_failed(entry_id, exc):
atomic_update(mgg.database.MediaEntry,
{'id': entry_id},
{u'state': u'failed',
- u'fail_error': unicode(exc.exception_path),
+ u'fail_error': six.text_type(exc.exception_path),
u'fail_metadata': exc.metadata})
else:
_log.warn("No idea what happened here, but it failed: %r", exc)
@@ -376,12 +378,11 @@ def store_public(entry, keyname, local_file, target_name=None,
entry.media_files[keyname], target_filepath)
if delete_if_exists:
mgg.public_store.delete_file(entry.media_files[keyname])
-
try:
mgg.public_store.copy_local_to_storage(local_file, target_filepath)
- except:
+ except Exception as e:
+ _log.error(u'Exception happened: {0}'.format(e))
raise PublicStoreFail(keyname=keyname)
-
# raise an error if the file failed to copy
if not mgg.public_store.file_exists(target_filepath):
raise PublicStoreFail(keyname=keyname)