import_export - Added some error handling
authorJoar Wandborg <git@wandborg.com>
Fri, 14 Oct 2011 01:15:50 +0000 (03:15 +0200)
committerJoar Wandborg <git@wandborg.com>
Fri, 14 Oct 2011 01:15:50 +0000 (03:15 +0200)
We still want to be able to do an export if a file can't be read

mediagoblin/gmg_commands/import_export.py

index 05edbfc80f918a2b7932d30f6c7baf304f75fd14..fefbdb4eac811a5c571e25cdea6409cb74254a3f 100644 (file)
@@ -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')