[bknr-cvs] hans changed trunk/projects/bos/m2/poi.lisp

BKNR Commits bknr at bknr.net
Thu Nov 27 10:05:53 UTC 2008


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

add poi-as-json function.

U   trunk/projects/bos/m2/poi.lisp

Modified: trunk/projects/bos/m2/poi.lisp
===================================================================
--- trunk/projects/bos/m2/poi.lisp	2008-11-27 09:37:31 UTC (rev 4085)
+++ trunk/projects/bos/m2/poi.lisp	2008-11-27 10:05:53 UTC (rev 4086)
@@ -336,15 +336,18 @@
    "url" (poi-movie-url movie)
    "timestamp" (format-date-time (poi-medium-creation-time movie) :mail-style t)))
 
+(defun poi-as-json (poi language)
+  (let ((*language* language))
+    (json:with-object ()
+      (json-encode poi)
+      (json:with-object-element ("media")
+        (json:with-array ()
+          (dolist (medium (poi-media poi))
+            (json:with-object ()
+              (json-encode medium))))))))
+
 (defun pois-as-json (language)
-  (let ((*language* language))
-    (json:with-array ()
-      (dolist (poi (class-instances 'poi))
-        (when (poi-complete poi language)
-          (json:with-object ()
-            (json-encode poi)
-            (json:with-object-element ("media")
-              (json:with-array ()
-                (dolist (medium (poi-media poi))
-                  (json:with-object ()
-                    (json-encode medium)))))))))))
+  (json:with-array ()
+    (dolist (poi (class-instances 'poi))
+      (when (poi-complete poi language)
+        (poi-as-json poi language)))))





More information about the Bknr-cvs mailing list