mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
templates: Use None as a default instead of {} for extra_config.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ ${unsafe(txt)}
|
||||
</%def>
|
||||
|
||||
|
||||
<%def name="js_setup(extra_config={})">
|
||||
<%def name="js_setup(extra_config=None)">
|
||||
<script type="text/javascript" id="config">
|
||||
r.setup(${unsafe(json.dumps(js_config(extra_config)))})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user