summaryrefslogtreecommitdiffstats
path: root/.emacs.d/snippets/python-mode/permission_guard
blob: ab538950793f2e1570cc9bcebf549604b23a0cbd (plain)
1
2
3
4
5
6
7
8
9
# -*- mode: snippet -*-
# name: Permission guard
# key: defm
# --
@method_decorator(permission_required('$1',
                                      raise_exception=True))
def dispatch(self, *args, **kwargs):
    '''Make sure the user has the $1 permission.'''
    return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs)