Commit d26a4544 authored by Michal Čihař's avatar Michal Čihař

Create source index in case it does not exist (issue #34)

I don't see way how user could get there as source index is created by
syncdb hook. The only way seems to be creating whoosh-index dir
manually.
parent 9cfc1d54
...@@ -57,10 +57,13 @@ class Index(object): ...@@ -57,10 +57,13 @@ class Index(object):
Returns source index. Returns source index.
''' '''
if self._source is None: if self._source is None:
self._source = open_dir( try:
settings.WHOOSH_INDEX, self._source = open_dir(
indexname = 'source' settings.WHOOSH_INDEX,
) indexname = 'source'
)
except whoosh.index.EmptyIndexError:
self._source = create_source_index()
return self._source return self._source
def target(self, lang): def target(self, lang):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment