Mercurial > p > roundup > code
comparison roundup/cgi/wsgi_handler.py @ 7820:da4c51effdfd
chore(lint): fix imports, normalize trailing , on list/tuple
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 20 Mar 2024 17:18:52 -0400 |
| parents | 0fe2b9f6e19f |
| children | dbeb6bf056c7 |
comparison
equal
deleted
inserted
replaced
| 7819:0fe2b9f6e19f | 7820:da4c51effdfd |
|---|---|
| 3 # This module is free software, you may redistribute it | 3 # This module is free software, you may redistribute it |
| 4 # and/or modify under the same terms as Python. | 4 # and/or modify under the same terms as Python. |
| 5 # | 5 # |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import weakref | |
| 9 | |
| 10 from contextlib import contextmanager | 8 from contextlib import contextmanager |
| 11 | 9 |
| 10 import roundup.instance | |
| 11 from roundup.anypy import http_ | |
| 12 from roundup.anypy.html import html_escape | 12 from roundup.anypy.html import html_escape |
| 13 | 13 from roundup.anypy.strings import s2b |
| 14 import roundup.instance | |
| 15 from roundup.cgi import TranslationService | 14 from roundup.cgi import TranslationService |
| 16 from roundup.anypy import http_ | |
| 17 from roundup.anypy.strings import s2b | |
| 18 | |
| 19 from roundup.cgi.client import BinaryFieldStorage | 15 from roundup.cgi.client import BinaryFieldStorage |
| 20 | 16 |
| 21 BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler | 17 BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler |
| 22 DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE | 18 DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE |
| 23 | 19 |
| 26 http_.server.BaseHTTPRequestHandler.responses[429] | 22 http_.server.BaseHTTPRequestHandler.responses[429] |
| 27 except KeyError: | 23 except KeyError: |
| 28 http_.server.BaseHTTPRequestHandler.responses[429] = ( | 24 http_.server.BaseHTTPRequestHandler.responses[429] = ( |
| 29 'Too Many Requests', | 25 'Too Many Requests', |
| 30 'The user has sent too many requests in ' | 26 'The user has sent too many requests in ' |
| 31 'a given amount of time ("rate limiting")' | 27 'a given amount of time ("rate limiting")', |
| 32 ) | 28 ) |
| 33 | 29 |
| 34 class Headers(object): | 30 class Headers(object): |
| 35 """ Idea more or less stolen from the 'apache.py' in same directory. | 31 """ Idea more or less stolen from the 'apache.py' in same directory. |
| 36 Except that wsgi stores http headers in environment. | 32 Except that wsgi stores http headers in environment. |
