Commit 318acd5a authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Replace algorithm list with a tuple

parent c8f6f561
...@@ -175,8 +175,8 @@ def parse_params(indict, *specs): ...@@ -175,8 +175,8 @@ def parse_params(indict, *specs):
parameters=outdict, parameters=outdict,
errors=wrong_params) errors=wrong_params)
raise message raise message
if 'algorithm' in outdict and not isinstance(outdict['algorithm'], list): if 'algorithm' in outdict and not isinstance(outdict['algorithm'], tuple):
outdict['algorithm'] = list(outdict['algorithm'].split(',')) outdict['algorithm'] = tuple(outdict['algorithm'].split(','))
return outdict return outdict
......
...@@ -196,7 +196,7 @@ def api_root(plugin): ...@@ -196,7 +196,7 @@ def api_root(plugin):
if plugin: if plugin:
plugin = plugin.replace('+', '/') plugin = plugin.replace('+', '/')
plugin = plugin.split('/') plugin = plugin.split('/')
req.parameters['algorithm'] = plugin req.parameters['algorithm'] = tuple(plugin)
return current_app.senpy.analyse(req) return current_app.senpy.analyse(req)
......
...@@ -74,6 +74,7 @@ class BlueprintsTest(TestCase): ...@@ -74,6 +74,7 @@ class BlueprintsTest(TestCase):
The results for a POST request should be the same as for a GET request. The results for a POST request should be the same as for a GET request.
""" """
resp = self.client.post("/api/", data={'i': 'My aloha mohame', resp = self.client.post("/api/", data={'i': 'My aloha mohame',
'algorithm': 'rand',
'with_parameters': True}) 'with_parameters': True})
self.assertCode(resp, 200) self.assertCode(resp, 200)
js = parse_resp(resp) js = parse_resp(resp)
......
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