Skip to content

Commit

Permalink
Avoid mutable default value in generic_*_renderer
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 28, 2018
1 parent 525de99 commit c55f840
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nikola/nikola.py
Expand Up @@ -2430,7 +2430,7 @@ def atom_post_text(post, text):
data = data.decode('utf-8')
atom_file.write(data)

def generic_index_renderer(self, lang, posts, indexes_title, template_name, context_source, kw, basename, page_link, page_path, additional_dependencies=[]):
def generic_index_renderer(self, lang, posts, indexes_title, template_name, context_source, kw, basename, page_link, page_path, additional_dependencies=None):
"""Create an index page.
lang: The language
Expand Down Expand Up @@ -2467,6 +2467,9 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont
kw['indexes_pretty_page_url'] = self.config["INDEXES_PRETTY_PAGE_URL"]
kw['show_index_page_navigation'] = self.config['SHOW_INDEX_PAGE_NAVIGATION']

if additional_dependencies is None:
additional_dependencies = []

# Split in smaller lists
lists = []
if kw["indexes_static"]:
Expand Down Expand Up @@ -2579,7 +2582,7 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont
'uptodate': [utils.config_changed(kw, 'nikola.nikola.Nikola.generic_index_renderer')],
}, kw["filters"])

def generic_atom_renderer(self, lang, posts, context_source, kw, basename, classification, kind, additional_dependencies=[]):
def generic_atom_renderer(self, lang, posts, context_source, kw, basename, classification, kind, additional_dependencies=None):
"""Create an Atom feed.
lang: The language
Expand All @@ -2602,6 +2605,9 @@ def generic_atom_renderer(self, lang, posts, context_source, kw, basename, class
kw['feed_plain'] = self.config['FEED_PLAIN']
kw['feed_previewimage'] = self.config['FEED_PREVIEWIMAGE']

if additional_dependencies is None:
additional_dependencies = []

post_list = posts[:kw["feed_length"]]
feedlink = self.link(kind + "_atom", classification, lang)
feedpath = self.path(kind + "_atom", classification, lang)
Expand Down

0 comments on commit c55f840

Please sign in to comment.