コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
 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)
コード例 #4
0
ファイル: hwdb.py プロジェクト: vitaminmoo/unnaturalcode
 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)