Mercurial > p > roundup > code
changeset 8408:e882a5d52ae5
refactor: move RateLimitExceeded to roundup.cgi.exceptions
RateLimitExceeded is an HTTP exception that raises code 429. Move it
to roundup.cgi.exceptions where all the other exceptions that result
in http status codes are located. Also make it inherit from
HTTPException since it is one.
Also add docstrings for all HTTP exceptions and order HTTPExceptions
by status code.
BREAKING CHANGE: if somebody is importing RateLimitExceeded they will
need to change their import. I consider it unlikely anybody is using
RateLimitExceeded. Detectors and extensions are unlikely to raise
RateLimitExceeded. So I am leaving it out of the upgrading doc. Just
doc in change log.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 10 Aug 2025 21:27:06 -0400 |
| parents | 700424ba015c |
| children | c9bec888c3c8 |
| files | CHANGES.txt roundup/cgi/actions.py roundup/cgi/client.py roundup/cgi/exceptions.py roundup/exceptions.py |
| diffstat | 5 files changed, 25 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun Aug 10 20:57:57 2025 -0400 +++ b/CHANGES.txt Sun Aug 10 21:27:06 2025 -0400 @@ -13,6 +13,19 @@ python 3.6 or newer (3.4/3.5 might work, but they are not tested). Roundup 2.4.0 is the last release to support Python 2. +2026-XX-XX 2.6.0 + +Fixed: + +- performance improvement to session_dbm.py:clean(). Also add warning + log message if clean takes longer than 3 seconds. (John Rouillard) +- move RateLimitExceeded exception from roundup.exceptions to + roundup.cgi.exceptions. Also it now inherits from HTTPException + rather than Exception since it is an HTTP exception. (John + Rouillard) + +Features: + 2025-07-13 2.5.0 Fixed:
--- a/roundup/cgi/actions.py Sun Aug 10 20:57:57 2025 -0400 +++ b/roundup/cgi/actions.py Sun Aug 10 21:27:06 2025 -0400 @@ -11,8 +11,9 @@ from roundup.anypy.html import html_escape from roundup.anypy.strings import StringIO from roundup.cgi import exceptions, templating +from roundup.cgi.exceptions import RateLimitExceeded from roundup.cgi.timestamp import Timestamped -from roundup.exceptions import RateLimitExceeded, Reject, RejectRaw +from roundup.exceptions import Reject, RejectRaw from roundup.i18n import _ from roundup.mailgw import uidFromAddress from roundup.rate_limit import Gcra, RateLimit
--- a/roundup/cgi/client.py Sun Aug 10 20:57:57 2025 -0400 +++ b/roundup/cgi/client.py Sun Aug 10 21:27:06 2025 -0400 @@ -40,6 +40,7 @@ IndexerQueryError, NotFound, NotModified, + RateLimitExceeded, Redirect, SendFile, SendStaticFile, @@ -48,7 +49,6 @@ from roundup.cgi.form_parser import FormParser from roundup.exceptions import ( LoginError, - RateLimitExceeded, Reject, RejectRaw, Unauthorised,
--- a/roundup/cgi/exceptions.py Sun Aug 10 20:57:57 2025 -0400 +++ b/roundup/cgi/exceptions.py Sun Aug 10 21:27:06 2025 -0400 @@ -24,6 +24,11 @@ pass +class NotModified(HTTPException): + """HTTP 304 status code""" + pass + + class NotFound(HTTPException): """HTTP 404 status code unless self.response_code is set to 400 prior to raising exception. @@ -31,13 +36,13 @@ pass -class NotModified(HTTPException): - """HTTP 304 status code""" +class PreconditionFailed(HTTPException): + """HTTP 412 status code""" pass -class PreconditionFailed(HTTPException): - """HTTP 412 status code""" +class RateLimitExceeded(HTTPException): + """HTTP 429 error code""" pass
