Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Resolve issue #7: crash on empty text.

  • Loading branch information...
commit 01230a98f7bc9d9d7ad14b385bc6825a7a7d70e4 1 parent 83e1fd4
@dnephin authored
Showing with 4 additions and 3 deletions.
  1. +1 −1  plugin-src/setup.py
  2. +3 −2 plugin-src/tracadvsearch/backend.py
View
2  plugin-src/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup
PACKAGE = 'TracAdvancedSearch'
-VERSION = '0.5'
+VERSION = '0.5.1'
setup(name=PACKAGE,
version=VERSION,
View
5 plugin-src/tracadvsearch/backend.py
@@ -85,10 +85,9 @@ def query_backend(self, criteria):
raise SearchBackendException(e)
for result in results:
result['title'] = result['name']
- result['summary'] = self._build_summary(result['text'], criteria['q'])
+ result['summary'] = self._build_summary(result.get('text'), criteria['q'])
result['date'] = self._date_from_solr(result['time'])
del result['time']
- del result['text']
del result['name']
return (results.hits, results.docs)
@@ -97,6 +96,8 @@ def _build_summary(self, text, query):
"""Build a summary which highlights the search terms."""
if not query:
return text[:500]
+ if not text:
+ return ''
return shorten_result(text, query.split(), maxlen=500)
Please sign in to comment.
Something went wrong with that request. Please try again.