Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
senpy
senpy
Commits
f6ca82ca
Commit
f6ca82ca
authored
Nov 06, 2018
by
J. Fernando Sánchez
Browse files
Merge branch '56-exception-when-using-post' into 'master'
Replace algorithm list with a tuple Closes
#56
See merge request
!25
parents
c8f6f561
318acd5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
senpy/api.py
View file @
f6ca82ca
...
...
@@ -175,8 +175,8 @@ def parse_params(indict, *specs):
parameters
=
outdict
,
errors
=
wrong_params
)
raise
message
if
'algorithm'
in
outdict
and
not
isinstance
(
outdict
[
'algorithm'
],
list
):
outdict
[
'algorithm'
]
=
list
(
outdict
[
'algorithm'
].
split
(
','
))
if
'algorithm'
in
outdict
and
not
isinstance
(
outdict
[
'algorithm'
],
tuple
):
outdict
[
'algorithm'
]
=
tuple
(
outdict
[
'algorithm'
].
split
(
','
))
return
outdict
...
...
senpy/blueprints.py
View file @
f6ca82ca
...
...
@@ -196,7 +196,7 @@ def api_root(plugin):
if
plugin
:
plugin
=
plugin
.
replace
(
'+'
,
'/'
)
plugin
=
plugin
.
split
(
'/'
)
req
.
parameters
[
'algorithm'
]
=
plugin
req
.
parameters
[
'algorithm'
]
=
tuple
(
plugin
)
return
current_app
.
senpy
.
analyse
(
req
)
...
...
tests/test_blueprints.py
View file @
f6ca82ca
...
...
@@ -74,6 +74,7 @@ class BlueprintsTest(TestCase):
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'
,
'algorithm'
:
'rand'
,
'with_parameters'
:
True
})
self
.
assertCode
(
resp
,
200
)
js
=
parse_resp
(
resp
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment