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

Class-based views #167

Merged
merged 27 commits into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cdddf63
Rename view tests to be easier to locate
jace Feb 13, 2018
822cf72
render_with tweaks
jace Feb 13, 2018
25ffb04
Introducing class-based views
jace Feb 13, 2018
f027e94
Fix tests for Python 2.7
jace Feb 14, 2018
635a4c5
b'str' works in Py2. Who knew?
jace Feb 14, 2018
01ccd87
Allow subclasses to replace view handlers while keeping routes
jace Feb 14, 2018
53eadc2
Docstrings for ClassView tests
jace Feb 14, 2018
87dc295
Add ClassView.get_view and support added routes on existing handlers
jace Feb 14, 2018
3f1041f
Replace ClassView.get_view with add_route_for
jace Feb 14, 2018
e86e491
Documentation and misc cleanup in ClassView
jace Feb 14, 2018
c99971b
Add a view decorator wrapper to make reroute work
jace Feb 14, 2018
3346323
Add test for direct call to a view
jace Feb 14, 2018
796f0dd
First pass at ModelView
jace Feb 14, 2018
7a17962
Support relationship traversal in InstanceLoader
jace Feb 15, 2018
7aa7d14
Merge branch 'master' into classview
jace Feb 20, 2018
33195a7
Added requires_permission decorator for current_auth
jace Feb 20, 2018
290749f
Fix PermissionMixin check
jace Feb 20, 2018
5e8b450
current_view proxy (also available in Jinja2 env)
jace Feb 20, 2018
d364ea9
Add support for permissions in InstanceLoader
jace Feb 20, 2018
3a51e9c
Fix doctest for InspectableSet
jace Feb 20, 2018
7ec7561
Tweak ModelView for better sanity
jace Feb 22, 2018
e70cf51
Fix url_name_suuid breakage with RoleMixin's proxy
jace Feb 22, 2018
43ec78e
Misc cleanup in StateManager
jace Feb 22, 2018
a54d23d
Added url_change_check decorator and mixin class
jace Feb 22, 2018
ec3c402
Fix url_name_suuid+test
jace Feb 22, 2018
c03a035
Add an after_request handler to ClassView
jace Feb 22, 2018
a93fccf
Drop self.kwargs in ModelView and update documentation
jace Feb 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
``coaster.views.requestargs``
* New: ``coaster.auth`` module with a ``current_auth`` proxy that provides
a standardised API for login managers to use
* New: ``coaster.views.classview`` provides a new take on organising views
into a class


0.6.0
Expand Down
3 changes: 3 additions & 0 deletions coaster/sqlalchemy/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ def url_for(self, action='view', **kwargs):

@classmethod
def is_url_for(cls, _action, _endpoint=None, _external=None, **paramattrs):
"""
View decorator that registers the view as a :meth:`url_for` target.
"""
def decorator(f):
if 'url_for_endpoints' not in cls.__dict__:
cls.url_for_endpoints = {} # Stick it into the class with the first endpoint
Expand Down
1 change: 1 addition & 0 deletions coaster/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
from __future__ import absolute_import
from .misc import * # NOQA
from .decorators import * # NOQA
from .classview import * # NOQA
Loading