annotate roundup/anypy/scandir_.py @ 8586:31a8a6faa2fa

bug: Allow UsageError exception to use more specific error code UsageError exception returned 400 error code but should return 405 when generated for a bad http method. Modified error handler to use 400 error code if self.response_code was less then 400. This should reproduce the standard error of 400 if one was not specified and preserve any other explicitly set response code. Also enhanced a test case to verify the 405 is returned.
author John Rouillard <rouilj@ieee.org>
date Mon, 20 Apr 2026 03:09:30 -0400
parents 5c5723cd721a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8091
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
1 try:
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
2 # python 3.5+
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
3 from os import scandir
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
4 except ImportError:
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
5 # python 2 fallback
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
6 import os
8258
5c5723cd721a chore(ruff): order imports.
John Rouillard <rouilj@ieee.org>
parents: 8091
diff changeset
7
5c5723cd721a chore(ruff): order imports.
John Rouillard <rouilj@ieee.org>
parents: 8091
diff changeset
8 import scandir # pip package
8091
586f76eb33e8 fix: keep python2 working a little longer.
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
9 os.scandir = scandir.scandir

Roundup Issue Tracker: http://roundup-tracker.org/