Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
using get_context() method in all Page subclasses
  • Loading branch information
joshourisman committed Feb 10, 2012
1 parent ae88974 commit 0e99569
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rabbitfish/pages.py
Expand Up @@ -24,7 +24,7 @@ def render_to_string(self):
print("Rendering page {0} with {1}.".format(self.name, self.template))
template = env.get_template(self.template)
content = yaml.load(open("content/{}.yaml".format(self.name)))
return template.render(**content)
return template.render(self.get_context(object=content))

def render_to_output(self):
if not os.path.exists(self.directory):
Expand All @@ -48,7 +48,7 @@ def render_to_string(self):

pages = []
for content in content_list:
html = template.render({'object': content})
html = template.render(self.get_context(object=content))
url_context = {
'slug': content['slug'],
}
Expand Down Expand Up @@ -100,7 +100,7 @@ def render_to_string(self):
page = content_list.__next__()
page['url'] = self.get_page_url(page)
index.append(page)
return template.render({'object_list': index})
return template.render(self.get_context(object_list=index))

def render_to_output(self, dynamic_pages):
self.dynamic_pages = dynamic_pages
Expand Down

0 comments on commit 0e99569

Please sign in to comment.