aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-10-14 03:15:50 +0200
committerJoar Wandborg <git@wandborg.com>2011-10-14 03:15:50 +0200
commita7ca2a72118f0e0e72bdc2a0547b80ae0d0a32ea (patch)
tree5a3252c9f5dd606cb153a366d4ef0e284b2bc4c0
parenta249b6d3a2e50a1cabd76a240ee391d9e54b1fbf (diff)
downloadmediagoblin-a7ca2a72118f0e0e72bdc2a0547b80ae0d0a32ea.tar.lz
mediagoblin-a7ca2a72118f0e0e72bdc2a0547b80ae0d0a32ea.tar.xz
mediagoblin-a7ca2a72118f0e0e72bdc2a0547b80ae0d0a32ea.zip
import_export - Added some error handling
We still want to be able to do an export if a file can't be read
-rw-r--r--mediagoblin/gmg_commands/import_export.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py
index 05edbfc8..fefbdb4e 100644
--- a/mediagoblin/gmg_commands/import_export.py
+++ b/mediagoblin/gmg_commands/import_export.py
@@ -215,10 +215,12 @@ def _export_media(db, args):
_log.info('Exporting {0} - {1}'.format(
entry['title'],
name))
-
- mc_file = media_cache.get_file(path, mode='wb')
- mc_file.write(
- mg_globals.public_store.get_file(path, mode='rb').read())
+ try:
+ mc_file = media_cache.get_file(path, mode='wb')
+ mc_file.write(
+ mg_globals.public_store.get_file(path, mode='rb').read())
+ except e:
+ _log.error('Failed: {0}'.format(e))
_log.info('...Media exported')