def test_conditions(self, scope, conditions): cur_list = self.get_cursor_list(conditions) if len(cur_list) == 1: cursor = cur_list[0] else: cursor = Join(self._itemdb, cur_list) cursor.set_scope(scope) iterator = iter(cursor) try: result = bool(next(iterator)) except StopIteration: result = False cursor.close() return result
def query(self, conditions): cur_list = self.get_cursor_list(conditions) if len(cur_list) == 1: return cur_list[0] else: c_join = Join(self._itemdb, cur_list) return c_join
def test_join(conditions, trans): cur_list = get_cursor_list(conditions, trans) c_join = None iterator = None try: c_join = Join(_itemdb, cur_list, trans) iterator = iter(c_join) try: result = bool(iterator.next()) except StopIteration: result = False finally: if iterator != None: iterator.close() if c_join != None: c_join.close() return result