Created
October 14, 2011 21:33
-
-
Save cduruk/1288420 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from foo import view_helpers | |
class AdminView(views.BaseView): | |
@view.view_config(route_name='admin.home', | |
decorator=views.logged_in_view_decorator, | |
renderer='admin/home.mako') | |
@view_helpers.require_groups(['employees']) | |
def home(self): | |
resp = dict() | |
resp['page_type'] = 'home' | |
return resp | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class require_groups(object): | |
def __init__(self, arg1): | |
self._arg1 = arg1 | |
def __call__(self, func): | |
def wrapped(my_view): | |
print(self._arg1) | |
return my_view | |
return wrapped(func) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment