Pre-generate thumbnails in image thumbnails display form to avoid broken thumbnails dur to conflict errors
--- a/src/pyams_file/zmi/image.py Tue Sep 12 11:29:48 2017 +0200
+++ b/src/pyams_file/zmi/image.py Tue Sep 12 12:36:09 2017 +0200
@@ -16,6 +16,7 @@
# import standard library
import random
import sys
+import transaction
from collections import OrderedDict
# import interfaces
@@ -684,6 +685,13 @@
adapters = sorted(registry.getAdapters((self.context, ), IThumbnailer),
key=lambda x: x[1].weight)
for name, adapter in adapters:
+ thumbnails = IThumbnail(self.context)
+ if name:
+ selection = thumbnails.get_selection(name)
+ transaction.commit()
+ thumbnails = IThumbnail(selection)
+ thumbnails.get_thumbnail('200x128', 'jpeg')
thumbnailers.setdefault(translate(adapter.section), []).append({'name': name,
'label': translate(adapter.label)})
+ transaction.commit()
return thumbnailers