Package couchdbkit :: Package consumer :: Module base
[hide private]
[frames] | no frames]

Source Code for Module couchdbkit.consumer.base

 1  # -*- coding: utf-8 - 
 2  # 
 3  # This file is part of couchdbkit released under the MIT license.  
 4  # See the NOTICE for more information. 
 5   
6 -def check_callable(cb):
7 if not callable(cb): 8 raise TypeError("callback isn't a callable")
9
10 -class ConsumerBase(object):
11
12 - def __init__(self, db, **kwargs):
13 self.db = db
14
15 - def fetch(self, cb=None, **params):
16 resp = self.db.res.get("_changes", **params) 17 if cb is not None: 18 check_callable(cb) 19 cb(resp.json_body) 20 else: 21 return resp.json_body
22
23 - def wait_once(self, cb=None, **params):
24 raise NotImplementedError
25
26 - def wait(self, cb, **params):
27 raise NotImplementedError
28
29 - def wait_once_async(self, cb, **params):
30 raise NotImplementedError
31
32 - def wait_async(self, cb, **params):
33 raise NotImplementedError
34