mengzhuo avatar mengzhuo committed bc75e64

Complete has_doc method document

Comments (0)

Files changed (2)

         If one or more documents are not found in the database, a NotFound
         exception is raised.
 
+    has_doc(self, doc_id):
+        See whether given `doc_id` existed in then given database.
+        Return True/False
+
     save_doc(self, doc):
         Save/create a document to/in a given database. Response is a dict
         with id and rev of the saved doc.
            "BadRequest", "NotFound", "MethodNotAllowed", "Conflict",
            "PreconditionFailed", "InternalServerError"]
 
-__version__ = '0.2.1'
+__version__ = '0.2.2'
 
 
 import copy
 
     @gen.coroutine
     def has_doc(self, doc_id):
-        """Get document with the given `doc_id`."""
+        """
+        See whether given doc_id existed in then given database.
+        Return True/False
+        """
         url = '/'.join((self.db_name, url_escape(doc_id)))
         r = yield self._http_head(url)
-        raise gen.Return(True if r['code'] == 200 else False)
+        raise gen.Return(r['code'] == 200)
 
     @gen.coroutine
     def get_docs(self, doc_ids):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.