Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (40 sloc) 1.32 KB
from django.conf import settings
from mapstory.models import *
from mapstory.util import lazy_context
import re
def _sections():
return list(Section.objects.order_by('order'))
def _resources():
return list(Resource.objects.order_by('order'))
_ua = re.compile('MSIE (\d+)\.')
def page(req):
'''provide base template context'''
# detect old browsers - probably should fix to use more robust framework
# for now, IE7 causes lots of trouble
old_browser = False
agent = req.META.get('HTTP_USER_AGENT','')
if agent:
match =
if match:
version = int(
old_browser = version < 8
if old_browser:
# the user has understood
if 'iunderstand' in req.COOKIES:
old_browser = False
#@todo better of using a template_tag
page = {
'sections' : _sections(),
'resources' : _resources(),
#@todo temp for design work
'design_mode' : settings.DESIGN_MODE,
# we could do this through debug but it's nicer to have finer grained control
'enable_analytics' : settings.ENABLE_ANALYTICS,
'old_browser' : old_browser
return {'page':page,'cache_time':60}
Jump to Line
Something went wrong with that request. Please try again.