예제 #1
0
 def format_list(self):
     db = Database('tucker')
     response = yield db.list('agenda/html',
                              'nomfup',
                              key='n',
                              limit=3,
                              descending=True)
     print response.body
예제 #2
0
    def why_init(self):
        db = Database('players')

        application = tornado.web.Application([
            (r'/(.*?)/score)', RankingsUpdater),
        ]).listen(1920)
        tornado.ioloop.IOLoop.instance().start()
예제 #3
0
    def why_jumpy(self):
        db = Database('players')

        class RankingsUpdater(tornado.web.RequestHandler):
            @tornado.web.asynchronous
            def post(self, player_id):
                self.new_score = int(self.request.body)
                db.get(player_id, callback=self.got_player)

            def got_player(doc, status):
                doc.score = self.new_score
                db.save(doc, callback=self.saved_player)

            def saved_player(conflicts, status):
                db.view('leaderboard/highscores', callback=self.got_highscores)

            def got_highscores(rows, status):
                self.write(json.dumps(rows))
                self.finish()
예제 #4
0
파일: examples.py 프로젝트: 0x68/corduroy
 def format_show(self):
     db = Database('mannion')
     response = yield db.show('records/csv', '1978-wotw', include_titles=True)
     print response.headers['Content-Type']
예제 #5
0
파일: examples.py 프로젝트: 0x68/corduroy
 def query_simple(self):
     db = Database('dosac')
     rows = yield db.view('employees/byname')
     print rows
예제 #6
0
파일: examples.py 프로젝트: 0x68/corduroy
 def batch_get(self):
     db = Database('backbench')
     doc_ids = ['ballentine', 'holhurst', 'swain']
     docs = yield db.get(doc_ids)
     
     print docs[0]
예제 #7
0
파일: examples.py 프로젝트: 0x68/corduroy
 def doc_get(self):
     db = Database('underlings')
     ollie = yield db.get('lackey-129')
     
     print ollie
     print 'Mr. %(first)s %(last)s can be found at %(office)s.' % ollie
예제 #8
0
    def doc_get(self):
        db = Database('underlings')
        ollie = yield db.get('lackey-129')

        print ollie
        print 'Mr. %(first)s %(last)s can be found at %(office)s.' % ollie
예제 #9
0
파일: examples.py 프로젝트: 0x68/corduroy
 def replicator_convenience(self):
     local_db = Database('localdb')
     yield local_db.push(remote_db, 
                         "http://elsewhere.com:5984/remotedb", 
                         continuous=True, 
                         _id='local-to-remote')
예제 #10
0
 def changes_seq(self):
     db = Database('watched')
     info = yield db.info()
     print info.update_seq
예제 #11
0
 def replicator_convenience(self):
     local_db = Database('localdb')
     yield local_db.push(remote_db,
                         "http://elsewhere.com:5984/remotedb",
                         continuous=True,
                         _id='local-to-remote')
예제 #12
0
 def replicate_push(self):
     local_db = Database('localdb')
     remote_db = Database('http://elsewhere.com:5984/remotedb')
     yield local_db.push(remote_db)
     yield local_db.pull(remote_db)
예제 #13
0
 def format_show(self):
     db = Database('mannion')
     response = yield db.show('records/csv',
                              '1978-wotw',
                              include_titles=True)
     print response.headers['Content-Type']
예제 #14
0
 def query_simple(self):
     db = Database('dosac')
     rows = yield db.view('employees/byname')
     print rows
예제 #15
0
    def batch_get(self):
        db = Database('backbench')
        doc_ids = ['ballentine', 'holhurst', 'swain']
        docs = yield db.get(doc_ids)

        print docs[0]
예제 #16
0
파일: examples.py 프로젝트: 0x68/corduroy
 def format_list(self):
     db = Database('tucker')
     response = yield db.list('agenda/html', 'nomfup', 
                              key='n', limit=3, descending=True)
     print response.body
예제 #17
0
파일: examples.py 프로젝트: 0x68/corduroy
 def replicate_push(self):
     local_db = Database('localdb')
     remote_db = Database('http://elsewhere.com:5984/remotedb')
     yield local_db.push(remote_db)
     yield local_db.pull(remote_db)
예제 #18
0
 def cords_boilerplate(self):
     from corduroy import Database, NotFound, relax
     people_db = Database('people')  # i.e., http://127.0.0.1:5984/people
예제 #19
0
파일: examples.py 프로젝트: 0x68/corduroy
 def changes_seq(self):
     db = Database('watched')
     info = yield db.info()
     print info.update_seq
예제 #20
0
 def db_init(self):
     db = Database('http://127.0.0.1:5984/some_db_name')
     db = Database('some_db_name')