diff options
author | Tom Willemse | 2019-08-28 00:06:55 -0700 |
---|---|---|
committer | Tom Willemse | 2019-08-28 00:07:35 -0700 |
commit | 5ad89196c2692e0018d6cfeb708d22fd6620a027 (patch) | |
tree | 2418bb691917bd1ac1cffc8c174688c38d1258ff /oni-python/snippets/python-mode/permission_guard | |
parent | e530fbfc5f47e5fb19107f442f3d752ed049817c (diff) | |
download | emacs-config-5ad89196c2692e0018d6cfeb708d22fd6620a027.tar.gz emacs-config-5ad89196c2692e0018d6cfeb708d22fd6620a027.zip |
Add snippets for ‘oni-python’
Diffstat (limited to 'oni-python/snippets/python-mode/permission_guard')
-rw-r--r-- | oni-python/snippets/python-mode/permission_guard | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/oni-python/snippets/python-mode/permission_guard b/oni-python/snippets/python-mode/permission_guard new file mode 100644 index 0000000..ab53895 --- /dev/null +++ b/oni-python/snippets/python-mode/permission_guard @@ -0,0 +1,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)
\ No newline at end of file |