Implement task API with input validation; implement error handling; refactoring
This commit is contained in:
parent
19d264a03b
commit
50aff05614
24 changed files with 612 additions and 131 deletions
|
|
@ -1,16 +1,11 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Callable, Type, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from flask import Blueprint
|
||||
from flask.views import View
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tofu_api.app import App
|
||||
|
||||
__all__ = [
|
||||
'BaseBlueprint',
|
||||
]
|
||||
|
||||
|
||||
class BaseBlueprint(Blueprint, ABC):
|
||||
"""
|
||||
|
|
@ -62,11 +57,3 @@ class BaseBlueprint(Blueprint, ABC):
|
|||
Register child blueprints and URL rules.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def create_view_func(view_cls: Type[View], *args, **kwargs) -> Callable:
|
||||
"""
|
||||
Helper function to create a view function from a `View` class using `view_cls.as_view()`.
|
||||
All arguments are passed to the constructor of the view class.
|
||||
"""
|
||||
return view_cls.as_view(view_cls.__name__, *args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue