Example #1
0
    def PUT(self, db):
        LOG.debug('adding database %s' % db)

        if self.client.db_init(db):
            return ok()

        return error()
Example #2
0
    def DELETE(self, db):
        LOG.debug('deleting database %s' % db)

        if self.client.db_delete(db):
            return ok()

        return error()
Example #3
0
    def DELETE(self, db, doc):
        LOG.debug('with database %s deleting document %s' % (db, doc))

        if self.client.doc_delete(db, doc):
            return ok()

        return error()
Example #4
0
    def PUT(self, db, doc, content=None):
        LOG.debug('with database %s adding document %s' % (db, doc))

        if self.client.doc_save(db, doc, json.loads(content)):
            return ok()

        return error()
Example #5
0
    def GET(self, db):
        LOG.debug('fetching database %s', db)

        documents = self.client.db_fetch(db)

        if documents:
            return ok(json.dumps({
                'documents': self.client.db_fetch(db)
            }))

        return not_found()
Example #6
0
    def GET(self, db, doc):
        LOG.debug('with database %s fetching document %s' % (db, doc))

        document = self.client.doc_fetch(db, doc)

        if document:
            return ok(json.dumps({
                'document': document
            }))

        return not_found()
Example #7
0
 def GET(self):
     LOG.debug('fetching server status')
     return ok()