-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
Description
api.search fails if wikipages are not enabled.
Steps to reproduce
Select a project.id for a project in which wikipages aren't enabled
Run api.search(project.id, 'search term')
Versions
Python Version: 3.9.1
python-taiga version: latest (1.0)
Expected behaviour
api.search should return a taiga.client.SearchResult object
Actual behaviour
api.search throws the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/taiga/client.py", line 100, in search
search_result.wikipages = self.wikipages.parse_list(
KeyError: 'wikipages'
Additional information
If the following fix is acceptable, I'll submit a pull request.
This basically wraps a conditional around line 100 in client.py
if project.is_wiki_activated:
search_result.wikipages = self.wikipages.parse_list(
result['wikipages']
)
else:
search_result.epics = self.epics.parse_list(
result['epics']
)