def post_publish(sender, **kwargs):
permanent_cache.delete('catalogue.book_list')
+ permanent_cache.delete('catalogue.catalogue')
Book.published.connect(post_publish)
""" remove the book from search index, when it is deleted."""
import search
idx = search.Index()
- idx.open(timeout=10000) # 10 seconds timeout.
- try:
- idx.remove_book(instance)
- idx.index_tags()
- finally:
- idx.close()
+ idx.remove_book(instance)
+ idx.index_tags()