Merge "Remove arguments "{}" in function definitions"
This commit is contained in:
commit
b43efaba7a
@ -43,8 +43,9 @@ class TemplateTagTests(test.TestCase):
|
|||||||
tag_call = "{%% %s %%}" % tag_name
|
tag_call = "{%% %s %%}" % tag_name
|
||||||
return self.render_template(tag_call, tag_require)
|
return self.render_template(tag_call, tag_require)
|
||||||
|
|
||||||
def render_template(self, template_text, tag_require='', context={}):
|
def render_template(self, template_text, tag_require='', context=None):
|
||||||
"""Render a Custom Template to string."""
|
"""Render a Custom Template to string."""
|
||||||
|
context = context or {}
|
||||||
template = Template("{%% load %s %%} %s"
|
template = Template("{%% load %s %%} %s"
|
||||||
% (tag_require, template_text))
|
% (tag_require, template_text))
|
||||||
return template.render(Context(context))
|
return template.render(Context(context))
|
||||||
|
@ -316,8 +316,9 @@ def metadefs_namespace_list(request,
|
|||||||
return namespaces, has_more_data, has_prev_data
|
return namespaces, has_more_data, has_prev_data
|
||||||
|
|
||||||
|
|
||||||
def metadefs_namespace_full_list(request, resource_type, filters={},
|
def metadefs_namespace_full_list(request, resource_type, filters=None,
|
||||||
*args, **kwargs):
|
*args, **kwargs):
|
||||||
|
filters = filters or {}
|
||||||
filters['resource_types'] = [resource_type]
|
filters['resource_types'] = [resource_type]
|
||||||
namespaces, has_more_data, has_prev_data = metadefs_namespace_list(
|
namespaces, has_more_data, has_prev_data = metadefs_namespace_list(
|
||||||
request, filters, *args, **kwargs
|
request, filters, *args, **kwargs
|
||||||
|
@ -147,7 +147,7 @@ def ajax(authenticated=True, data_required=False,
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
def parse_filters_kwargs(request, client_keywords={}):
|
def parse_filters_kwargs(request, client_keywords=None):
|
||||||
"""Extract REST filter parameters from the request GET args.
|
"""Extract REST filter parameters from the request GET args.
|
||||||
|
|
||||||
Client processes some keywords separately from filters and takes
|
Client processes some keywords separately from filters and takes
|
||||||
@ -156,6 +156,7 @@ def parse_filters_kwargs(request, client_keywords={}):
|
|||||||
"""
|
"""
|
||||||
filters = {}
|
filters = {}
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
client_keywords = client_keywords or {}
|
||||||
for param in request.GET:
|
for param in request.GET:
|
||||||
if param in client_keywords:
|
if param in client_keywords:
|
||||||
kwargs[param] = request.GET[param]
|
kwargs[param] = request.GET[param]
|
||||||
|
Loading…
Reference in New Issue
Block a user