Commits

Luke Plant committed 7462024

Removed unnecessary use of 'lazy'

Comments (0)

Files changed (1)

cciw/cciwmain/common.py

 from django.contrib.sites.models import Site
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse
-from django.utils.functional import lazy
 from django.utils.safestring import mark_safe
 from django.views.generic.edit import FormView
 from django.views.generic.list import ListView
     else:
         request_path = request.path
 
-    # Memoized, lazy function to avoid queries we don't
-    # always need.
+    # As a callable, get_links will get called automatically by the template
+    # renderer *when needed*, so we avoid queries. We memoize in links_cache to
+    # avoid double queries
     links_cache = []
     def get_links():
         if len(links_cache) > 0:
             links_cache.extend(links)
             return links
 
-    context['menulinks'] = lazy(get_links, list)
+    context['menulinks'] = get_links
     context['GOOGLE_ANALYTICS_ACCOUNT'] = getattr(settings, 'GOOGLE_ANALYTICS_ACCOUNT', '')
     context['PRODUCTION'] = (settings.LIVEBOX and settings.PRODUCTION)