1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 02:51:00 +00:00
seahub/seahub/base/mixins.py
2013-05-02 19:27:17 +08:00

23 lines
689 B
Python

from django.utils.decorators import method_decorator
from auth.decorators import login_required
# from base.decorators import ctx_switch_required
class LoginRequiredMixin(object):
"""
View mixin which verifies that the user has authenticated.
NOTE:
This should be the left-most mixin of a view.
"""
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
# class CtxSwitchRequiredMixin(object):
# @method_decorator(ctx_switch_required)
# def dispatch(self, *args, **kwargs):
# return super(CtxSwitchRequiredMixin, self).dispatch(*args, **kwargs)