From d8d7e5a509189030248e3f3e8516116e2a5fd6bf Mon Sep 17 00:00:00 2001 From: Andre D Date: Thu, 18 Oct 2012 14:39:08 -0500 Subject: [PATCH] templates: Use None as a default instead of {} for extra_config. --- r2/r2/lib/pages/pages.py | 2 +- r2/r2/lib/template_helpers.py | 5 +++-- r2/r2/templates/utils.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index b7f5baacf..a184479e4 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -137,7 +137,7 @@ class Reddit(Templated): def __init__(self, space_compress = True, nav_menus = None, loginbox = True, infotext = '', content = None, short_description='', title = '', robots = None, show_sidebar = True, footer = True, srbar = True, page_classes = None, - show_wiki_actions = False, extra_js_config = {}, **context): + show_wiki_actions = False, extra_js_config = None, **context): Templated.__init__(self, **context) self.title = title self.short_description = short_description diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index 3ac083f07..eaa2ca7ee 100755 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -116,7 +116,7 @@ def s3_https_if_secure(url): replace = "https://%s/" % s3_direct_url return url.replace("http://", replace) -def js_config(extra_config={}): +def js_config(extra_config=None): config = { # is the user logged in? "logged": c.user_is_loggedin and c.user.name, @@ -151,7 +151,8 @@ def js_config(extra_config={}): "static_root": static(''), } - config.update(extra_config) + if extra_config: + config.update(extra_config) return config diff --git a/r2/r2/templates/utils.html b/r2/r2/templates/utils.html index bdc110bf1..040a669fc 100755 --- a/r2/r2/templates/utils.html +++ b/r2/r2/templates/utils.html @@ -407,7 +407,7 @@ ${unsafe(txt)} -<%def name="js_setup(extra_config={})"> +<%def name="js_setup(extra_config=None)">