nodes have their links

Change-Id: I71a41a4981e958b17839126279f44647502d34b6
This commit is contained in:
Fabio Verboso 2017-03-14 16:50:34 +01:00
parent aa648f2861
commit a080dbc96b
2 changed files with 4 additions and 1 deletions

View File

@ -27,7 +27,7 @@ def build_url(resource, resource_args, bookmark=False, base_url=None):
# FIXME(lucasagomes): I'm getting a 404 when doing a GET on
# a nested resource that the URL ends with a '/'.
# https://groups.google.com/forum/#!topic/pecan-dev/QfSeviLg5qs
# template += '%(args)s' if resource_args.startswith('?') else '/%(args)s'
template += '%(args)s' if resource_args.startswith('?') else '/%(args)s'
return template % {'url': base_url, 'res': resource, 'args': resource_args}

View File

@ -42,6 +42,7 @@ class Node(base.APIBase):
session = wsme.wsattr(wtypes.text)
project = types.uuid
mobile = types.boolean
links = wsme.wsattr([link.Link], readonly=True)
location = wsme.wsattr([loc.Location])
extra = types.jsontype
@ -61,6 +62,8 @@ class Node(base.APIBase):
if fields is not None:
node.unset_fields_except(fields)
# rel_name, url, resource, resource_args,
# bookmark=False, type=wtypes.Unset
node.links = [link.Link.make_link('self', url, 'nodes',
node_uuid),
link.Link.make_link('bookmark', url, 'nodes',