Commit 5b3f5a47 by Diana Huang

Add marketing_link to the Template context dictionary.

Pep8 fixes
parent c9a6fe18
...@@ -19,6 +19,7 @@ from . import middleware ...@@ -19,6 +19,7 @@ from . import middleware
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
def marketing_link(name): def marketing_link(name):
"""Returns the correct URL for a link to the marketing site """Returns the correct URL for a link to the marketing site
depending on if the marketing site is enabled depending on if the marketing site is enabled
...@@ -39,6 +40,7 @@ def marketing_link(name): ...@@ -39,6 +40,7 @@ def marketing_link(name):
else: else:
return '' return ''
def render_to_string(template_name, dictionary, context=None, namespace='main'): def render_to_string(template_name, dictionary, context=None, namespace='main'):
context_instance = Context(dictionary) context_instance = Context(dictionary)
# add dictionary to context_instance # add dictionary to context_instance
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
from django.conf import settings from django.conf import settings
from mako.template import Template as MakoTemplate from mako.template import Template as MakoTemplate
from mitxmako.shortcuts import marketing_link
from mitxmako import middleware from mitxmako import middleware
...@@ -37,7 +38,6 @@ class Template(MakoTemplate): ...@@ -37,7 +38,6 @@ class Template(MakoTemplate):
kwargs.update(overrides) kwargs.update(overrides)
super(Template, self).__init__(*args, **kwargs) super(Template, self).__init__(*args, **kwargs)
def render(self, context_instance): def render(self, context_instance):
""" """
This takes a render call with a context (from Django) and translates This takes a render call with a context (from Django) and translates
...@@ -55,5 +55,6 @@ class Template(MakoTemplate): ...@@ -55,5 +55,6 @@ class Template(MakoTemplate):
context_dictionary['settings'] = settings context_dictionary['settings'] = settings
context_dictionary['MITX_ROOT_URL'] = settings.MITX_ROOT_URL context_dictionary['MITX_ROOT_URL'] = settings.MITX_ROOT_URL
context_dictionary['django_context'] = context_instance context_dictionary['django_context'] = context_instance
context_dictionary['marketing_link'] = marketing_link
return super(Template, self).render_unicode(**context_dictionary) return super(Template, self).render_unicode(**context_dictionary)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment