def __contains__( self, docid ): """Return whether the document identified by ``docid`` is present in the database. """ try : doc = Document( self, docid ) doc.head() return True except : return False
def __delitem__( self, docid ): """Remove the document specified by ``docid`` from database""" doc = Document( self, docid ) headers = doc.head() etag = headers['Etag'][1:-1] # Strip the leading and trailing quotes doc.delete( rev=etag )