Permalink
Browse files

Account for mandatory variables (set them to empty strings)

  • Loading branch information...
1 parent 43d8ff1 commit e4643924a35880e37c171de60777ead282f97fe9 @jbillo committed Sep 30, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 musik/web/application.py
View
@@ -82,6 +82,13 @@ def _render_page(self, template_names, **kwargs):
if type(template_names) != list:
# Create one-element list
template_names = [template_names]
+
+ # Make sure mandatory variables are always in kwargs
+ # These will cause the page to fail miserably if not present
+ mandatory_vars = ('title', 'js_appends')
+ for var in mandatory_vars:
+ if var not in kwargs:
+ kwargs[var] = u''
result.append(self._header(**kwargs))

0 comments on commit e464392

Please sign in to comment.