accept tag values in the body as well as URL

The JS client passes arguments to the PUT call in the URL so we need
the tags argument to the put() method. The python client passes
arguments encoded in the body of the request, so we need the body
argument. Merge the two sets of values so that inside the function we
only have to process one list.

Change-Id: I21a82321fabbe4f0d0a5db5a9db5dda8f65f21bb
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-10-08 12:49:58 -04:00
parent a5d8b2b64d
commit 46ad47ecd9

View File

@ -87,7 +87,7 @@ class TagsController(rest.RestController):
@secure(checks.authenticated) @secure(checks.authenticated)
@wsme_pecan.wsexpose(wmodels.Story, int, body=[wtypes.text]) @wsme_pecan.wsexpose(wmodels.Story, int, body=[wtypes.text])
def put(self, story_id, tags): def put(self, story_id, tags=[], body=[]):
"""Add a list of tags to a Story. """Add a list of tags to a Story.
Example:: Example::
@ -100,6 +100,7 @@ class TagsController(rest.RestController):
:param story_id: An id of a Story to which the tags should be added. :param story_id: An id of a Story to which the tags should be added.
:param tags: A list of tags to be added. :param tags: A list of tags to be added.
""" """
tags = (tags or []) + (body or [])
story = stories_api.story_get( story = stories_api.story_get(
story_id, current_user=request.current_user_id) story_id, current_user=request.current_user_id)