Skip to content

Commit

Permalink
fix: security api (#1831)
Browse files Browse the repository at this point in the history
* fix: security api

* fix tests and add more tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* add type annotations to base

* test mypy

* fix lint

* fix tests

* fix mypy

* fix mypy
  • Loading branch information
dpgaspar committed Apr 28, 2022
1 parent cb9c985 commit 090ddb4
Show file tree
Hide file tree
Showing 25 changed files with 722 additions and 422 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions examples/crud_rest_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

basedir = os.path.abspath(os.path.dirname(__file__))

FAB_ADD_SECURITY_API = True
CSRF_ENABLED = True
SECRET_KEY = "\2\1thisismyscretkey\1\2\e\y\y\h"

Expand Down
10 changes: 6 additions & 4 deletions flask_appbuilder/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .convert import Model2SchemaConverter
from .schemas import get_info_schema, get_item_schema, get_list_schema
from .._compat import as_unicode
from ..baseviews import AbstractViewApi
from ..const import (
API_ADD_COLUMNS_RES_KEY,
API_ADD_COLUMNS_RIS_KEY,
Expand Down Expand Up @@ -203,7 +204,7 @@ def wrap(f):
return wrap


class BaseApi(object):
class BaseApi(AbstractViewApi):
"""
All apis inherit from this class.
it's constructor will register your exposed urls on flask
Expand All @@ -213,8 +214,6 @@ class BaseApi(object):
but provides a common base for all APIS.
"""

appbuilder = None
blueprint = None
endpoint: Optional[str] = None

version: Optional[str] = "v1"
Expand Down Expand Up @@ -436,6 +435,9 @@ def __init__(self) -> None:
Initialization of extra args
"""
self.appbuilder = None
self.blueprint = None

# Init OpenAPI
self._response_key_func_mappings = dict()
self.apispec_parameter_schemas = self.apispec_parameter_schemas or dict()
Expand Down Expand Up @@ -652,7 +654,7 @@ def get_uninit_inner_views(self):
"""
return []

def get_init_inner_views(self, views):
def get_init_inner_views(self):
"""
Sets initialized inner views
"""
Expand Down
Loading

0 comments on commit 090ddb4

Please sign in to comment.