work in progress delicious import and path fix
[gitology.git] / src / gitology / d / utils.py
blob5cb80d82f0a19d30238900111879523c7fbd86c3
1 # imports
2 from django.conf import settings
4 from gitology.config import settings as gsettings
6 # context_processor # {{{
7 def context_processor(request):
8 return { 'LOCAL_INSTANCE': getattr(settings, 'LOCAL_INSTANCE', False) }
9 # }}}
11 # select_theme # {{{
12 def select_theme(view_func):
13 def wrapped(request, *args, **kw):
14 if request.GET.get("theme"):
15 gsettings.threadlocal.theme = request.GET["theme"]
16 elif "THEME" in request.COOKIES:
17 gsettings.threadlocal.theme = request.COOKIES["THEME"]
18 elif "THEME" in request.session:
19 gsettings.threadlocal.theme = request.session["THEME"]
20 elif "THEME" in gsettings.DEFAULTS:
21 gsettings.threadlocal.theme = gsettings.DEFAULTS.THEME
22 return view_func(request, *args, **kw)
23 wrapped.__doc__ = view_func.__doc__
24 wrapped.__dict__ = view_func.__dict__
25 return wrapped
26 # }}}
28 # MONTHS # {{{
29 MONTHS = {
30 1:'january', 2:'february', 3:'march', 4:'april', 5:'may', 6:'june',
31 7:'july', 8:'august', 9:'september', 10:'october', 11:'november',
32 12:'december'
34 # }}}