def hasDatabaseBeenWrittenTo(self, test_token): """Is the object made by `writeToDatabase` present in the database? :param test_token: The return value from `writeToDatabase`. :return: Has the change represented by `test_token` been made to the database? """ query = IStore(Person).find(Person, Person.name == test_token) return query.one() is not None
def hasDatabaseBeenWrittenTo(self, test_token): """Is the object made by `writeToDatabase` present in the database? :param test_token: The return value from `writeToDatabase`. :return: Has the change represented by `test_token` been made to the database? """ query = IStore(Person).find(Person, Person.name == test_token) return query.one() is not None
def getOrCreateDeviceClass(self, main_class, sub_class=None): """See `IHWDevice.`""" result_set = IStore(HWDeviceClass).find( HWDeviceClass, HWDeviceClass.device == self.id, HWDeviceClass.main_class == main_class, HWDeviceClass.sub_class == sub_class) existing_record = result_set.one() if existing_record is not None: return existing_record return HWDeviceClass( device=self, main_class=main_class, sub_class=sub_class)
def getOrCreateDeviceClass(self, main_class, sub_class=None): """See `IHWDevice.`""" result_set = IStore(HWDeviceClass).find( HWDeviceClass, HWDeviceClass.device == self.id, HWDeviceClass.main_class == main_class, HWDeviceClass.sub_class == sub_class, ) existing_record = result_set.one() if existing_record is not None: return existing_record return HWDeviceClass(device=self, main_class=main_class, sub_class=sub_class)