Closed devdupont closed 5 years ago
Thanks for bringing this up! that's an interesting situation that i didn't realize I had caused with the previous change (I think older versions < 1.3.9 would likely support the inheritance situation, but i'm not positive). Anyway i was looking into this and it looks like I've got a fix for the problem. I've put up a PR (#18) which fixes it and adds a test case which is your example here, let me know what you think!
I changed those two lines in my local copy and everything appears to work now. Won't merge any changes until the library is updated, but thanks for the fix.
@flyinactor91 version 1.3.10 has been deployed to pypi containing this fix.
Looking at this to replace flask-restful since that extension is not Quart compatible. I noticed that the class-based resource model is the same. However, the
@app.route('/')
decorator syntax breaks Resource objects that use inheritance to override get, put, post, etc. Basic example:localhost:5000/hello -> "hello" localhost:5000/goodbye -> "hello"
Flask-RESTful got around this by using
api.add_resource(MyResource, route)
instead of the decorator syntax. SincePint
overrides theQuart()
init, this could be added to thePint
class as an option. I see._add_resource
in the Pint class, but it's doing something else.