def apply_view_middleware(request):
 urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)
 urlresolvers.set_urlconf(urlconf)
 resolver = urlresolvers.RegexURLResolver('^/', urlconf)
 resolver_match = resolver.resolve(request.path_info)
 (callback, callback_args, callback_kwargs) = resolver_match
 request.resolver_match = resolver_match
 for middleware_path in settings.MIDDLEWARE_CLASSES:
  mw_class = import_string(middleware_path)
  try:
   mw_instance = mw_class()
  except MiddlewareNotUsed:
   continue
  if hasattr(mw_instance, 'process_view'):
   mw_instance.process_view(request, callback, callback_args, callback_kwargs)
 return request

def apply_view_middleware ( request ) : urlconf = getattr ( request , 'urlconf' , settings . ROOT_URLCONF ) urlresolvers . set_urlconf ( urlconf ) resolver = urlresolvers . RegexURLResolver ( '^/' , urlconf ) resolver_match = resolver . resolve ( request . path_info ) ( callback , callback_args , callback_kwargs ) = resolver_match request . resolver_match = resolver_match for middleware_path in settings . MIDDLEWARE_CLASSES : mw_class = import_string ( middleware_path ) try : mw_instance = mw_class ( ) except MiddlewareNotUsed : continue if hasattr ( mw_instance , 'process_view' ) : mw_instance . process_view ( request , callback , callback_args , callback_kwargs ) return request
apply all the process_view capable middleware configured into the given request .