Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with Flask 2.2.x #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mcb30
Copy link

@mcb30 mcb30 commented Mar 3, 2023

Flask 2.2.x removed the MethodViewType metaclass from which ResourceMeta currently inherits.

Fix by inheriting from type(MethodView) instead.

Fixes: #212
Fixed-by: James Wu [email protected]

Flask 2.2.x removed the MethodViewType metaclass from which
ResourceMeta currently inherits.

Fix by inheriting from type(MethodView) instead.

Fixed-by: James Wu <[email protected]>
Signed-off-by: Michael Brown <[email protected]>
@nbrinckm
Copy link

@akira-dev Just the question, if it would be possible to check this PR - as it would be really nice to be able to use more up to date flask versions.

@jondkelley
Copy link

jondkelley commented Jan 11, 2024

Why hasn't the maintainer responded to this?

Seems it is still broken.

python3 app.py
Traceback (most recent call last):
  File "/Users/toor/workspace/connexion/app.py", line 4, in <module>
    from flask_rest_jsonapi import Api, ResourceDetail, ResourceList, ResourceRelationship
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/__init__.py", line 3, in <module>
    from flask_rest_jsonapi.api import Api
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/api.py", line 12, in <module>
    from flask_rest_jsonapi.resource import ResourceList, ResourceRelationship
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/resource.py", line 12, in <module>
    from flask.views import MethodView, MethodViewType
ImportError: cannot import name 'MethodViewType' from 'flask.views' (/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask/views.py)
blinker==1.7.0
click==8.1.7
Flask==3.0.0
Flask-REST-JSONAPI==0.31.2
greenlet==3.0.3
importlib-metadata==7.0.1
itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.3
marshmallow==3.20.2
marshmallow-jsonapi==0.24.0
packaging==23.2
six==1.16.0
SQLAlchemy==2.0.25
typing_extensions==4.9.0
Werkzeug==3.0.1
zipp==3.17.0

@reduzent
Copy link

reduzent commented May 7, 2024

Please merge this trivial, but important fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MethodViewType was removed for Flask 2.2.x
4 participants