Mark Evenson
unread,Nov 16, 2012, 4:45:29 AM11/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to res...@googlegroups.com
Thanks so much for RESTAS! I'm a couple weeks into a reasonable-sized project where I find that RESTAS has met or exceeded my needs.
One of the things I have found productive has been a very interactive approach to working with routes. Since RESTAS:DEFINE-ROUTE thunks down to a DEFUN, after
(restas:define-route index ("" :content-type "text/html")
(who:with-html-output-to-string (out)
(:html
(:title "Main")
(:body (:p "Main page")))))
I can see what will be output via a simple
cl-user> (index)
"<html><title>Main</title><body><p>Main page</p></body></html>"
By setting various HUNCHENTOOT and RESTAS specials, I can usually rapidly iterate to the desired results.
The one problem I have found with this methodology is with the RESTAS:GENURL call. If I use the following
(restas:define-module #:foo)
(in-package #:foo)
(restas:define-route index ("" :content-type "text/html")
(who:with-html-output-to-string (out)
(:html
(:title "Main")
(:body (:p "Main page")
(:p (restas:genurl 'index))))))
then I get the following error when trying to invoke INDEX from the REPL:
There is no applicable method for the generic function
#<COMMON-LISP:STANDARD-GENERIC-FUNCTION
RESTAS:SUBMODULE-BASEURL (1)>
when called with arguments
(COMMON-LISP:NIL).
[Condition of type COMMON-LISP:SIMPLE-ERROR]
Restarts:
0: [RETRY] Retry calling the generic function.
1: [RETRY] Retry SLIME REPL evaluation request.
2: [*ABORT] Return to SLIME's top level.
3: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {1003378063}>)
Backtrace:
0: ((SB-PCL::FAST-METHOD COMMON-LISP:NO-APPLICABLE-METHOD (COMMON-LISP:T)) #<unused argument> #<unused argument> #<COMMON-LISP:STANDARD-GENERIC-FUNCTION RESTAS:SUBMODULE-BASEURL (1)> COMMON-LISP:NIL)
1: (SB-PCL::CALL-NO-APPLICABLE-METHOD #<COMMON-LISP:STANDARD-GENERIC-FUNCTION RESTAS:SUBMODULE-BASEURL (1)> (COMMON-LISP:NIL))
2: (RESTAS::SUBMODULE-FULL-BASEURL COMMON-LISP:NIL)
3: (RESTAS:GENURL INDEX)
4: (INDEX)
Is my usage pattern "just not going to work" as my code gets more sophisticated? Is there some sort of additional special that I should bind when invoking routes from the REPL? Would this go away if I used submodules?
Thanks again for RESTAS,
Mark