X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/0e241bee3f90eedd9bc2d339fdc51ce0bec71c72..d2536ed5c7d858a7af888569c740d44644b3a9cb:/apps/search/index.py 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)