def one(self, *largs, **kargs): kargs["limit"] = 1 db = lookup(kargs, "db", default = None, destroy = True) if db is None: db = self.getdb() cur = self.query(db =db, *largs, **kargs) r = cur.fetchone() if r is None: raise KeyError(kargs) return self.cl(drop_none(r), db = db)
def all(self, *largs, **kargs): db = lookup(kargs, "db", default = None, destroy = True) if db is None: db = self.getdb() cur = self.query(db = db, *largs, **kargs) return (self.cl(drop_none(r), db = db) for r in cur)