/usr/lib/python2.7/dist-packages/ratelimit/middleware.py is in python-django-ratelimit 0.4.0+8+gd58c489-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from django.conf import settings
from django.utils.importlib import import_module
from ratelimit.exceptions import Ratelimited
class RatelimitMiddleware(object):
def process_exception(self, request, exception):
if not isinstance(exception, Ratelimited):
return
module_name, _, view_name = settings.RATELIMIT_VIEW.rpartition('.')
module = import_module(module_name)
view = getattr(module, view_name)
return view(request, exception)
|