mirror of
https://github.com/searxng/searxng.git
synced 2024-11-13 21:51:08 +00:00
[mod] results: don't crash when an engine don't have a category
According to
820b468bfe/searx/engines/__init__.py (L87-L88)
an engine can have no category at all.
Without this commit, searx raise an exception in searx/results.py
Note: in this case, the engine is not shown in the preferences.
This commit is contained in:
parent
d41cafd5f3
commit
0ba74cd812
1 changed files with 3 additions and 2 deletions
|
@ -309,10 +309,11 @@ class ResultContainer:
|
||||||
|
|
||||||
for res in results:
|
for res in results:
|
||||||
# FIXME : handle more than one category per engine
|
# FIXME : handle more than one category per engine
|
||||||
res['category'] = engines[res['engine']].categories[0]
|
engine = engines[res['engine']]
|
||||||
|
res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''
|
||||||
|
|
||||||
# FIXME : handle more than one category per engine
|
# FIXME : handle more than one category per engine
|
||||||
category = engines[res['engine']].categories[0]\
|
category = res['category']\
|
||||||
+ ':' + res.get('template', '')\
|
+ ':' + res.get('template', '')\
|
||||||
+ ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
|
+ ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue