-
Notifications
You must be signed in to change notification settings - Fork 13
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
Figure out a better way to manage "current view" context #237
Comments
should be fairly easy to register the view |
yes, but that wouldn't let you do e.g. |
yeah. maybe something like class FooView(...):
authorization = FooAuth() # insert some python magic here that does `self.authorization.view = self`, I am pretty sure it's possible eg in the view constructor /shrug |
it works better if those are all classes, note. otherwise we'd be mutating objects or doing other magical things. |
Yeah, marshmallow and WTForms mutate field objects upon instantiation (marshmallow via a Perhaps deprecate class WidgetView(GenericModelView):
authorization_class = WidgetAuthorization | AdminAuthorization |
i'd call it filtering = Filtering(
name=operator.eq,
) we could have class Filtering:
name = operator.eq would make it better to extend across views, too class ExtendedView(BaseView):
class Filtering(BaseView.Filtering):
other_field = operator.eq |
I thought magical things are the norm in python (sqlalchemy?) :P I am fine with inlining things but it's a big change in terms of project structuring, in the sense that right now things are separated in modules by types, whereas with this approach they will be separated by functionality |
Yeah, I like the inlining idea in principle. Certainly a big change, though could be done iteratively. Also, |
depends how you use FR, if you are really high in the microservices spectrum, having every view in one file is very convenient. but if we look at our big services (mgmt), that retaliates. |
In many places, we have to explicitly pass the view into helper classes, e.g.
flask-resty/flask_resty/view.py
Line 295 in 438f439
It would be better if we could bind the view object to helper class instances, or else have some
flask_resty.current_view
proxy.The text was updated successfully, but these errors were encountered: