Source

HackersEdge / he_one / context_processors.py

Full commit
from django.core.cache import cache
from he_one.forms import AddressBarForm
from forums.forms import ForumSearchForm

def user_profile(req):
    if req.user.is_authenticated():
        profile = cache.get("profile-%s" % req.user.pk)
        return {'profile':profile}
    return {}

def lookup_forms(req):
    return {'addrbar_form':AddressBarForm(), 'forumsearch_form':ForumSearchForm()}

def user_tools(req):
    if req.user.is_authenticated():
        user_tools = cache.get("usertools-%s" % req.user.pk)
        return {'user_tools':user_tools}
    return {}