X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/0e241bee3f90eedd9bc2d339fdc51ce0bec71c72..5345c6e3640cc5f356b55348a5834e3a1987532d:/apps/search/index.py?ds=sidebyside diff --git a/apps/search/index.py b/apps/search/index.py index 66a7b3420..822429e75 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -93,7 +93,8 @@ class Snippets(object): def close(self): """Close snippet file""" - self.file.close() + if self.file: + self.file.close() def remove(self): self.revision = None @@ -829,11 +830,10 @@ class Search(SolrIndex): idx += 1 except IOError, e: - log.error("Cannot open snippet file for book id = %d [rev=%d], %s" % (book_id, revision, e)) + log.error("Cannot open snippet file for book id = %d [rev=%s], %s" % (book_id, revision, e)) return [] finally: - if snippets: - snippets.close() + snippets.close() # remove verse end markers.. snips = map(lambda s: s and s.replace("/\n", "\n"), snips)