Feture Description
I want to overwrite the implement of route partially when they belong to different version blueprint, and it raises sanic_routing.exceptions.RouteExists.
Sample Code
from sanic import Blueprint
from sanic.response import json
from sanic import Sanic
app = Sanic('test')
bpv1 = Blueprint('bpv1', version=1)
@bpv1.route('/hello')
async def root(request):
return json('hello v1')
app.blueprint(bpv1)
bpv2 = bpv1.copy('bpv2', version=2)
@bpv2.route('/hello')
async def root(request):
return json('hello v2')
app.blueprint(bpv2)
Current Solution
I get this solution from forum and i was encouraged to post new a feature request based on it~
bpv2 = bpv1.copy("bpv2", version=2)
bpv2._future_routes = {
route for route in bpv2._future_routes if route.uri != "/hello"
}
@bpv2.route("/hello")
async def root2(request):
return json("hello v2")
Web Link
https://community.sanicframework.org/t/how-to-overwrite-a-route-when-using-blueprint-copy/1067
Feture Description
I want to overwrite the implement of route partially when they belong to different version blueprint, and it raises sanic_routing.exceptions.RouteExists.
Sample Code
Current Solution
I get this solution from forum and i was encouraged to post new a feature request based on it~
Web Link
https://community.sanicframework.org/t/how-to-overwrite-a-route-when-using-blueprint-copy/1067