From 6a967d28ce0fb43a5507e999fb8aa27dde0faa16 Mon Sep 17 00:00:00 2001 From: "Kyle James Walker (he/him)" Date: Tue, 29 Mar 2022 19:45:08 -0700 Subject: [PATCH] Fix Flask 2x Support (#233) * Skip static rules When using Flask 2x the send_static_file function is a lambda and crashes the extraction of the rules_by_endpoint function. There is currently a PR that has a fix but it's been stale so I'm adding this as a possible alternate fix. The other fix is: https://github.com/jmcarp/flask-apispec/pull/230 * Update changelog Co-authored-by: Steven Loria --- CHANGELOG.rst | 8 ++++++++ flask_apispec/extension.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4af3336..76086a6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog --------- +0.11.1 (unreleased) +******************* + +Bug fixes: + +* Fix Flask 2.x support (:issue:`229`). Thanks :user:`KyleJamesWalker` for the PR. + + 0.11.0 (2020-10-25) ******************* diff --git a/flask_apispec/extension.py b/flask_apispec/extension.py index c1ef648..6fa4e27 100644 --- a/flask_apispec/extension.py +++ b/flask_apispec/extension.py @@ -103,6 +103,10 @@ def register_existing_resources(self): except ValueError: blueprint_name = None + # Skip static rules + if name == 'static': + continue + try: self.register(rule, blueprint=blueprint_name) except TypeError: