old_contents: # -*- coding: utf-8 -*-
  
  from .models.nonrel import User
  
  
  def mongodb_user(request):
  
      if request.user.is_anonymous():
          return {u'mongodb_user': None}
  
      try:
          mongodb_user = User.objects.get(id=request.session[u'mongodb_user_id'])
  
      except KeyError:
          mongodb_user = User.objects.get(django_user=request.user.id)
  
          # Cache it for next time.
          request.session[u'mongodb_user_id'] = mongodb_user.id
  
      return {u'mongodb_user': mongodb_user}
  
new_contents: # -*- coding: utf-8 -*-
  
  
  def mongodb_user(request):
      """ not the most usefull context manager in the world. """
  
      if request.user.is_anonymous():
          return {u'mongodb_user': None}
  
      return {u'mongodb_user': request.user.mongo}
  
subject: Simplify the context processor. Not very useful anymore, in fact.