Commit 2ffdb6ca authored by richardARPANET's avatar richardARPANET

Fix handing of national characters in title search

parent df7411d1
Pipeline #138 canceled with stage
......@@ -6,7 +6,7 @@ Release History
5.6.3 (unreleased)
++++++++++++++++++
- Nothing changed yet.
- Bugfix for handing of national characters within search methods.
5.6.2 (2018-07-09)
......
......@@ -7,6 +7,7 @@ from datetime import date
import tempfile
import logging
from trans import trans
import requests
from six import text_type
from six.moves import http_client as httplib
......@@ -148,8 +149,10 @@ class Imdb(Auth):
response.raise_for_status()
def _suggest_search(self, query):
query_encoded = quote(query)
first_alphanum_char = self._query_first_alpha_num(query)
# translates national characters into similar sounding latin characters
cleaned_query = trans(query)
query_encoded = quote(cleaned_query)
first_alphanum_char = self._query_first_alpha_num(cleaned_query)
path = '/suggests/{0}/{1}.json'.format(
first_alphanum_char, query_encoded
)
......
......@@ -106,6 +106,7 @@ def test_search_for_title_returns_no_results_if_name_query(client):
'[REC]鲁 Genesis (2012)',
'隆Three Amigos! (1986)',
'(Untitled) (2009)',
'脝on Flux(2005)',
])
def test_search_for_title_input_with_special_chars(query, client):
results = client.search_for_title(query)
......
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