1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/docs/dev/modules/middleware.py.md
Matt Griswold 57a4175c00 Support 202202 (#1125)
* New Field "Health Check" #512

* Add status_dashboard to fields #512

* RS Peer Checkbox also visible on IX Site #727

* Add "Management" search field to Advanced Search of Exchanges #506

* wrap correctly on mobile #881

* missing delete button for user #653

* Removed cruft from IX view template #881

* To force or not to force www, that is a question #916

* add health check fields to entity creation forms (fac, ix, net) (#512)

* status_dashboard should accept null values #512

* Sort usergroup names in https://peeringdb.com/cp/peeringdb_server/userpermission/xxxxx numerically #656

* fix issue with deleted entities showing up in search results #1042

* 2FA Backup Tokens language doesn't seem correct #908

* linting

* poetry relock

* fix user permission save trying to create a user

* add status_dashboard to mock data

* docs

* add api doc regen to gen_docs call
fix issue with run_tests if BASE_URL env var is set

* fix generate_schema typo

* linting

Co-authored-by: David Poarch <dpoarch@20c.com>
Co-authored-by: Stefan Pratter <stefan@20c.com>
2022-03-08 07:27:45 -06:00

1.5 KiB

Generated from middleware.py on 2022-03-07 17:01:26.860132

peeringdb_server.middleware

Custom django middleware.

Classes


CurrentRequestContext

CurrentRequestContext(builtins.object)

Middleware that sets the current request context.

This allows access to the current request from anywhere.

Methods

_call_

def __call__(self, request)

Call self as a function.


_init_

def __init__(self, get_response)

Initialize self. See help(type(self)) for accurate signature.


PDBCommonMiddleware

PDBCommonMiddleware(django.middleware.common.CommonMiddleware)

"Common" middleware for taking care of some basic operations:

- Forbid access to User-Agents in settings.DISALLOWED_USER_AGENTS

- URL rewriting: Based on the APPEND_SLASH and PREPEND_WWW settings,
  append missing slashes and/or prepends missing "www."s.

    - If APPEND_SLASH is set and the initial URL doesn't end with a
      slash, and it is not found in urlpatterns, form a new URL by
      appending a slash at the end. If this new URL is found in
      urlpatterns, return an HTTP redirect to this new URL; otherwise
      process the initial URL as usual.

  This behavior can be customized by subclassing CommonMiddleware and
  overriding the response_redirect_class attribute.

Methods

process_request

def process_request(self, request)

Check for denied User-Agents and rewrite the URL based on settings.APPEND_SLASH and settings.PREPEND_WWW