Merge "JSON Home data is required"
This commit is contained in:
commit
8566b7001d
|
@ -59,29 +59,22 @@ class Router(wsgi.ComposableRouter):
|
||||||
action='delete_%s' % self.key,
|
action='delete_%s' % self.key,
|
||||||
conditions=dict(method=['DELETE']))
|
conditions=dict(method=['DELETE']))
|
||||||
|
|
||||||
if self._resource_descriptions is not None:
|
|
||||||
# Add the collection resource and entity resource to the resource
|
# Add the collection resource and entity resource to the resource
|
||||||
# descriptions.
|
# descriptions.
|
||||||
|
|
||||||
collection_rel = json_home.build_v3_resource_relation(
|
collection_rel = json_home.build_v3_resource_relation(
|
||||||
self.collection_key)
|
self.collection_key)
|
||||||
self._resource_descriptions.append(
|
rel_data = {'href': collection_path, }
|
||||||
(collection_rel,
|
self._resource_descriptions.append((collection_rel, rel_data))
|
||||||
{
|
|
||||||
'href': collection_path,
|
|
||||||
}
|
|
||||||
))
|
|
||||||
|
|
||||||
if self._is_entity_implemented:
|
if self._is_entity_implemented:
|
||||||
entity_rel = json_home.build_v3_resource_relation(self.key)
|
entity_rel = json_home.build_v3_resource_relation(self.key)
|
||||||
id_str = '%s_id' % self.key
|
id_str = '%s_id' % self.key
|
||||||
id_param_rel = json_home.build_v3_parameter_relation(id_str)
|
id_param_rel = json_home.build_v3_parameter_relation(id_str)
|
||||||
self._resource_descriptions.append(
|
entity_rel_data = {
|
||||||
(entity_rel,
|
|
||||||
{
|
|
||||||
'href-template': entity_path,
|
'href-template': entity_path,
|
||||||
'href-vars': {
|
'href-vars': {
|
||||||
id_str: id_param_rel,
|
id_str: id_param_rel,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
))
|
self._resource_descriptions.append((entity_rel, entity_rel_data))
|
||||||
|
|
|
@ -634,10 +634,10 @@ class RoutersBase(object):
|
||||||
Use self._add_resource() to map routes for a resource.
|
Use self._add_resource() to map routes for a resource.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _add_resource(self, mapper, controller, path,
|
def _add_resource(self, mapper, controller, path, rel,
|
||||||
get_action=None, head_action=None, get_head_action=None,
|
get_action=None, head_action=None, get_head_action=None,
|
||||||
put_action=None, post_action=None, patch_action=None,
|
put_action=None, post_action=None, patch_action=None,
|
||||||
delete_action=None, get_post_action=None, rel=None,
|
delete_action=None, get_post_action=None,
|
||||||
path_vars=None):
|
path_vars=None):
|
||||||
if get_head_action:
|
if get_head_action:
|
||||||
mapper.connect(path, controller=controller, action=get_head_action,
|
mapper.connect(path, controller=controller, action=get_head_action,
|
||||||
|
@ -664,7 +664,6 @@ class RoutersBase(object):
|
||||||
mapper.connect(path, controller=controller, action=get_post_action,
|
mapper.connect(path, controller=controller, action=get_post_action,
|
||||||
conditions=dict(method=['GET', 'POST']))
|
conditions=dict(method=['GET', 'POST']))
|
||||||
|
|
||||||
if rel:
|
|
||||||
resource_data = dict()
|
resource_data = dict()
|
||||||
|
|
||||||
if path_vars:
|
if path_vars:
|
||||||
|
|
Loading…
Reference in New Issue