[bknr-cvs] r2400 - branches/bos/projects/bos/web

hhubner at common-lisp.net hhubner at common-lisp.net
Wed Jan 23 18:29:30 UTC 2008


Author: hhubner
Date: Wed Jan 23 13:29:30 2008
New Revision: 2400

Modified:
   branches/bos/projects/bos/web/boi-handlers.lisp
   branches/bos/projects/bos/web/bos.web.asd
   branches/bos/projects/bos/web/web-macros.lisp
Log:
Move WITH-XML-RESPONSE and WITH-XML-ERROR-HANDLER macros to web-macros.lisp


Modified: branches/bos/projects/bos/web/boi-handlers.lisp
==============================================================================
--- branches/bos/projects/bos/web/boi-handlers.lisp	(original)
+++ branches/bos/projects/bos/web/boi-handlers.lisp	Wed Jan 23 13:29:30 2008
@@ -3,30 +3,6 @@
 
 (enable-interpol-syntax)
 
-(defvar *xml-sink*)
-
-(defmacro with-xml-response ((&key (content-type "text/xml") (root-element "response")) &body body)
-  `(with-http-response (*req* *ent* :content-type ,content-type)
-     (with-query-params (*req* download)
-       (when download
-	 (setf (reply-header-slot-value *req* :content-disposition)
-	       (format nil "attachment; filename=~A" download))))
-     (with-http-body (*req* *ent*)
-       (let ((*xml-sink* (make-character-stream-sink net.html.generator:*html-stream* :canonical nil)))
-	 (with-xml-output *xml-sink*
-	   (with-element ,root-element
-	     , at body))))))
-
-(defmacro with-xml-error-handler (req &body body)
-  (declare (ignore req))
-  `(handler-case
-    (progn , at body)
-    (error (e)
-     (with-xml-response ()
-       (with-element "status"
-	 (attribute "failure" 1)
-	 (text (princ-to-string e)))))))
-
 (defclass boi-handler (page-handler)
   ())
 

Modified: branches/bos/projects/bos/web/bos.web.asd
==============================================================================
--- branches/bos/projects/bos/web/bos.web.asd	(original)
+++ branches/bos/projects/bos/web/bos.web.asd	Wed Jan 23 13:29:30 2008
@@ -30,7 +30,7 @@
 	       (:file "contract-handlers" :depends-on ("web-utils"))
 	       (:file "contract-image-handler" :depends-on ("web-utils"))
 	       (:file "reports-xml-handler" :depends-on ("boi-handlers"))
-	       (:file "kml-handlers" :depends-on ("boi-handlers"))
+	       (:file "kml-handlers" :depends-on ("packages" "web-macros"))
 	       (:file "sponsor-handlers" :depends-on ("web-utils"))
 	       (:file "news-handlers" :depends-on ("web-utils"))
 	       (:file "allocation-area-handlers" :depends-on ("web-utils"))

Modified: branches/bos/projects/bos/web/web-macros.lisp
==============================================================================
--- branches/bos/projects/bos/web/web-macros.lisp	(original)
+++ branches/bos/projects/bos/web/web-macros.lisp	Wed Jan 23 13:29:30 2008
@@ -5,3 +5,27 @@
 (defmacro with-bos-cms-page ((req &key title response) &rest body)
   `(with-bknr-page (,req :title ,title :response ,response)
     , at body))
+
+(defvar *xml-sink*)
+
+(defmacro with-xml-response ((&key (content-type "text/xml") (root-element "response")) &body body)
+  `(with-http-response (*req* *ent* :content-type ,content-type)
+     (with-query-params (*req* download)
+       (when download
+	 (setf (reply-header-slot-value *req* :content-disposition)
+	       (format nil "attachment; filename=~A" download))))
+     (with-http-body (*req* *ent*)
+       (let ((*xml-sink* (make-character-stream-sink net.html.generator:*html-stream* :canonical nil)))
+	 (with-xml-output *xml-sink*
+	   (with-element ,root-element
+	     , at body))))))
+
+(defmacro with-xml-error-handler (req &body body)
+  (declare (ignore req))
+  `(handler-case
+    (progn , at body)
+    (error (e)
+     (with-xml-response ()
+       (with-element "status"
+	 (attribute "failure" 1)
+	 (text (princ-to-string e)))))))



More information about the Bknr-cvs mailing list