Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix defresource, defroute to handle lambda var correctly. #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions common.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@
(t
(list type-spec t))))

(defun ensure-atom (thing)
(if (listp thing)
(ensure-atom (first thing))
thing))
(defun ensure-gf-lambda-var (thing)
(etypecase thing
(atom thing)
((cons symbol) (car thing))
((cons cons) thing)))

(defun ensure-uri (maybe-uri)
(etypecase maybe-uri
Expand Down Expand Up @@ -465,7 +466,7 @@ As a second value, return what RFC2388:PARSE-HEADER"
(proper-lambda-list
`(,verb-spec ,type-spec ,@(nthcdr 2 lambda-list)))
(simplified-lambda-list
(mapcar #'ensure-atom proper-lambda-list)))
(mapcar #'ensure-gf-lambda-var proper-lambda-list)))
`(progn
(unless (find-resource ',name)
(defresource ,name ,simplified-lambda-list))
Expand Down Expand Up @@ -512,7 +513,7 @@ As a second value, return what RFC2388:PARSE-HEADER"
else
collect option))
(simplified-lambda-list (mapcar #'(lambda (argspec)
(ensure-atom argspec))
(ensure-gf-lambda-var argspec))
lambda-list)))
`(progn
,@(if genpath-form `(,genpath-form))
Expand Down
2 changes: 1 addition & 1 deletion package.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(defpackage #:snooze-common
(:use #:cl)
(:export
#:ensure-atom
#:ensure-gf-lambda-var
#:content-type-spec-or-lose
#:verb-spec-or-lose
#:parse-defroute-args
Expand Down