old_contents: from django_globals import globals
  
  class Global(object):
      def process_request(self, request):
          globals.request = request
          if hasattr(request, 'user'):
              globals.user = request.user
          else:
              globals.user = None
  
  # retrocompatibility
  class User(Global):
      def __init__(self, *args, **kwargs):
          import warnings
          warnings.warn(
              'The `django_globals.middleware.User` middleware is deprecated, you should use `django_globals.middleware.Global`',
              DeprecationWarning,
              stacklevel=2
          )
          super(User, self).__init__(*args, **kwargs)
  
new_contents: from django_globals import globals
  
  class Global(object):
      def process_request(self, request):
          globals.request = request
          globals.user = getattr(request, 'user', None)
  
  # retrocompatibility
  class User(Global):
      def __init__(self, *args, **kwargs):
          import warnings
          warnings.warn(
              'The `django_globals.middleware.User` middleware is deprecated, you should use `django_globals.middleware.Global`',
              DeprecationWarning,
              stacklevel=2
          )
          super(User, self).__init__(*args, **kwargs)
  
subject: set globals.user to None if there is no user, second try, better