# -*- coding: utf-8; mode: snippet -*-
# contributor: Daniel Kraus <daniel@kraus.my>
# name: @view_config
# key: @v
# group: pyramid
# condition: (symbol-value 'pyramid-mode)
# --
@view_config(route_name='${1:$$(
                          pyramid-yas-completing-read "Route name: "
                            (-uniq (mapcar (lambda (c) (cdr (assoc 'name c))) (mapcar 'cdr (pyramid-get-views))))
                            nil nil nil 'pyramid-views-history
                          )}'${2:, request_method='${3:$$(yas-auto-next (yas-choose-value pyramid-request-methods))}'}${4:, permission='$5'})
def ${6:$$(unless yas-modified-p
            (concat (replace-regexp-in-string "[^_[:alnum:]]" "_" (yas-field-value 1))
                    (unless (equal (yas-field-value 3) "") "_")
                    (yas-field-value 3)
          ))}(request):
    $0
