+
+
+def customizations_hash(customizations):
+ customizations.sort()
+ return hash(tuple(customizations))
+
+
+def get_customized_pdf_path(book, customizations):
+ """
+ Returns a MEDIA_ROOT relative path for a customized pdf. The name will contain a hash of customization options.
+ """
+ h = customizations_hash(customizations)
+ return 'book/%s/%s-custom-%s.pdf' % (book.slug, book.slug, h)
+
+
+def clear_custom_pdf(book):
+ """
+ Returns a list of paths to generated customized pdf of a book
+ """
+ from waiter.utils import clear_cache
+ clear_cache('book/%s' % book.slug)