diff options
| author | 2026-09-08 14:56:51 -0700 | |
|---|---|---|
| committer | 2026-09-08 14:56:51 -0700 | |
| commit | 5fd4013f4565fb7f00c00c25490a263116042a08 (patch) | |
| tree | 8cb21cdc74bc311b3ac43aa51d70a12b5f835625 /emacs/.emacs.d/snippets/python-mode/permission_guard | |
| parent | 80fa614c3ca653228c2f32b39bf7cd8f37864bd9 (diff) | |
| download | new-dotfiles-5fd4013f4565fb7f00c00c25490a263116042a08.tar.gz new-dotfiles-5fd4013f4565fb7f00c00c25490a263116042a08.zip | |
emacs: Add snippets
Diffstat (limited to 'emacs/.emacs.d/snippets/python-mode/permission_guard')
| -rw-r--r-- | emacs/.emacs.d/snippets/python-mode/permission_guard | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/emacs/.emacs.d/snippets/python-mode/permission_guard b/emacs/.emacs.d/snippets/python-mode/permission_guard new file mode 100644 index 0000000..ab53895 --- /dev/null +++ b/emacs/.emacs.d/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 |
