changing NoSuchFiles for no_such_files

This commit is contained in:
Jorge Araya Navarro 2012-07-05 22:07:44 -06:00
parent fb2fbe2c0a
commit 6d539afda6

View File

@ -36,21 +36,21 @@ def delete_media_files(media):
Arguments: Arguments:
- media: A MediaEntry document - media: A MediaEntry document
""" """
noSuchFiles = [] no_such_files = []
for listpath in media.media_files.itervalues(): for listpath in media.media_files.itervalues():
try: try:
mg_globals.public_store.delete_file( mg_globals.public_store.delete_file(
listpath) listpath)
except OSError: except OSError:
noSuchFiles.append(_jointhat(listpath)) no_such_files.append(_jointhat(listpath))
for attachment in media.attachment_files: for attachment in media.attachment_files:
try: try:
mg_globals.public_store.delete_file( mg_globals.public_store.delete_file(
attachment['filepath']) attachment['filepath'])
except OSError: except OSError:
noSuchFiles.append(_jointhat(attachment)) no_such_files.append(_jointhat(attachment))
if noSuchFiles: if no_such_files:
# This breaks pep8 as far as I know # This breaks pep8 as far as I know
raise OSError, ", ".join(noSuchFiles) raise OSError, ", ".join(noSuchFiles)