[bknr-cvs] hans changed trunk/projects/quickhoney/src/handlers.lisp

BKNR Commits bknr at bknr.net
Thu Jul 31 07:44:11 UTC 2008


Revision: 3703
Author: hans
URL: http://bknr.net/trac/changeset/3703

STREAM->OUTPUT-STREAM to avoid package lock errors

U   trunk/projects/quickhoney/src/handlers.lisp

Modified: trunk/projects/quickhoney/src/handlers.lisp
===================================================================
--- trunk/projects/quickhoney/src/handlers.lisp	2008-07-31 06:18:02 UTC (rev 3702)
+++ trunk/projects/quickhoney/src/handlers.lisp	2008-07-31 07:44:11 UTC (rev 3703)
@@ -433,18 +433,18 @@
 (defvar *json-output*)
 
 (defclass json-output-stream ()
-  ((stream :reader stream
-           :initarg :stream)
+  ((output-stream :reader output-stream
+                  :initarg :output-stream)
    (stack :accessor stack
           :initform nil)))
 
 (defun next-aggregate-element ()
   (if (car (stack *json-output*))
-      (princ #\, (stream *json-output*))
+      (princ #\, (output-stream *json-output*))
       (setf (car (stack *json-output*)) t)))
 
 (defmacro with-json-output ((stream) &body body)
-  `(let ((*json-output* (make-instance 'json-output-stream :stream ,stream)))
+  `(let ((*json-output* (make-instance 'json-output-stream :output-stream ,stream)))
      , at body))
 
 (defmacro with-json-output-to-string (() &body body)
@@ -456,12 +456,12 @@
   `(progn
      (when (stack *json-output*)
        (next-aggregate-element))
-     (princ ,begin-char (stream *json-output*))
+     (princ ,begin-char (output-stream *json-output*))
      (push nil (stack *json-output*))
      (prog1
          (progn , at body)
        (pop (stack *json-output*))
-       (princ ,end-char (stream *json-output*)))))
+       (princ ,end-char (output-stream *json-output*)))))
 
 (defmacro with-json-array (() &body body)
   `(with-json-aggregate (#\[ #\])
@@ -473,13 +473,13 @@
 
 (defun encode-array-element (object)
   (next-aggregate-element)
-  (json:encode-json object (stream *json-output*)))
+  (json:encode-json object (output-stream *json-output*)))
 
 (defun encode-object-element (key value)
   (next-aggregate-element)
-  (json:encode-json key (stream *json-output*))
-  (princ #\: (stream *json-output*))
-  (json:encode-json value (stream *json-output*)))
+  (json:encode-json key (output-stream *json-output*))
+  (princ #\: (output-stream *json-output*))
+  (json:encode-json value (output-stream *json-output*)))
 
 (defmethod handle-object ((handler news-json-handler) (channel rss-channel))
   (with-http-response (:content-type "application/json")




More information about the Bknr-cvs mailing list