def flush_buffer(self): """Send the contents of the buffer to the server and clear it.""" try: for buf in self.buf.itervalues(): client.getdb().update(list(buf.itervalues())) except couchdb.ServerError: print self.buf self.buf = []
def flush_buffer(): global buf try: getdb().update(buf) except couchdb.ServerError: print buf buf=[] #, pushed_coords, pushed_nodes # global buffered_coords, buffered_nodes buf=[]
def nodeView(): return getdb().view("osmcouch/nodes")
def ways_with_nodes(): for row in ways(): nodeids = row.value['nodes'] row.value['nodes'] = map(lambda n: getdb()[str(n)], nodeids) yield row
def ways(): return getdb().iterview("osmcouch/ways", batchsize)