1
0
Fork 0
emacs-config/oni-python/snippets/python-mode/permission_guard

9 lines
388 B
Text
Raw Permalink Normal View History

2019-08-28 09:06:55 +02:00
# -*- 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)