[clouchdb-cvs] CVS clouchdb/src

peddy peddy at common-lisp.net
Sat Jun 6 18:37:10 UTC 2009


Update of /project/clouchdb/cvsroot/clouchdb/src
In directory cl-net:/tmp/cvs-serv9301

Modified Files:
	clouchdb.lisp 
Log Message:

Cleaned up some dumb code



--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2009/06/04 01:47:49	1.32
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2009/06/06 18:37:10	1.33
@@ -369,15 +369,11 @@
 
 (defun db-request (uri &rest args &key &allow-other-keys)
   "Used by all Couchdb APIs to make the actual REST request."
-  ;;(format t "uri: ~S~% args: ~S~%" (make-uri uri) args)
   (let ((*text-content-types* *text-types*))
     (multiple-value-bind (body status headers uri stream must-close reason-phrase)
 	(apply #'drakma:http-request (make-uri uri) args)
       (declare (ignore reason-phrase stream uri headers status))
-      ;;(format t "-> uri: ~a~%" uri)
-      ;;(format t "-> headers: ~S~%" headers)
       (cond (must-close
-             ;;(format t "body: ~A~%" body)
              (json-to-document body))
             (t nil)))))
 
@@ -639,17 +635,16 @@
 new document and assign a new ID. Therefore this is an easy method for
 copying documents. The return value includes the document ID in
 the :ID property."
-  (let* ((url (cat (url-encode *db-name*) "/"))
-         (res (ensure-db ()
-                (db-request url
+  (let ((res (ensure-db ()
+               (db-request (cat (url-encode *db-name*) "/")
                            :content-type "text/javascript"
                            :external-format-out +utf-8+
                            :content-length nil
+                           :method :post
                            :content (document-to-json 
-                                     (document-update-notify *document-update-fn* doc))
-                           :method :post))))
+                                     (document-update-notify *document-update-fn* doc))))))
     (when (document-property :|error| res)
-      (error 'doc-error) :id nil :reason (document-property :|reason| res))
+      (error 'doc-error :id nil :reason (document-property :|reason| res)))
     res))
 
 (defun create-document (doc &key id attachments)
@@ -696,7 +691,7 @@
                                 "?rev=" (url-encode (value-as-string rev)))
                            :method :delete))))
                (when (document-property :|error| res)
-                 (error 'doc-error) :id id :reason (document-property :|reason| res))
+                 (error 'doc-error :id id :reason (document-property :|reason| res)))
                res)))
     (cond ((not (null document))
 	   (delete-document :id (document-property :|_id| document)
@@ -719,7 +714,7 @@
 (defun ad-hoc-view (view &rest options &key key start-key start-key-docid
                     end-key count update descending skip)
   "Execute query using an ad-hoc view."
-  (declare (ignore key start-key start-key-docid end-key count 
+  (declare (ignore key start-key start-key-docid end-key count
                    update descending skip))
   (ensure-db ()
     (db-request (cat (url-encode *db-name*) "/_temp_view")
@@ -798,8 +793,8 @@
 returns results in reverse order. If update is t, does not refresh
 view for query, use for higher performance but possible data
 inconsistency."
-  (declare (ignore key start-key start-key-docid end-key count 
-                   update descending skip))
+  (declare (ignore key start-key start-key-docid end-key
+                   limit update descending skip))
   (ensure-db ()
     (db-request (cat (url-encode *db-name*) "/_design/" 
                      (url-encode id) "/_view/" (url-encode view))





More information about the clouchdb-cvs mailing list