fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix in librarian
[wolnelektury.git]
/
apps
/
picture
/
models.py
diff --git
a/apps/picture/models.py
b/apps/picture/models.py
index
ee2b4e0
..
5aabe3c
100644
(file)
--- a/
apps/picture/models.py
+++ b/
apps/picture/models.py
@@
-150,7
+150,7
@@
class Picture(models.Model):
xml_file = File(open(xml_file))
close_xml_file = True
xml_file = File(open(xml_file))
close_xml_file = True
-
try
:
+
with transaction.atomic()
:
# use librarian to parse meta-data
if image_store is None:
image_store = ImageStore(picture_storage.path('images'))
# use librarian to parse meta-data
if image_store is None:
image_store = ImageStore(picture_storage.path('images'))
@@
-240,18
+240,10
@@
class Picture(models.Model):
picture.save()
tasks.generate_picture_html(picture.id)
picture.save()
tasks.generate_picture_html(picture.id)
- except Exception, ex:
- logging.exception("Exception during import, rolling back")
- transaction.rollback()
- raise ex
-
- finally:
- if close_xml_file:
- xml_file.close()
- if close_image_file:
- image_file.close()
-
- transaction.commit()
+ if close_xml_file:
+ xml_file.close()
+ if close_image_file:
+ image_file.close()
return picture
return picture