-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Expectation:
When using url_for
for an endpoint with an <any(foo, bar):arg>
argument in its route, it will raise an error for arguments that are not part of the any statement.
Actual result:
It returns an invalid URL
Example:
from flask import Flask, url_for, redirect
app = Flask(__name__)
@app.route("/any/<any(foo, bar):part>")
def url_with_any(part):
return part
@app.route("/")
def index():
return redirect(url_for("url_with_any", part="doesnotexist")) # this will 404
Environment:
- Python version: Python 3.10.4
- Flask version: Flask 2.1.1