Пример #1
0
    def to_dict(self):
        """
        This converts everything in this object to a dictionary.

        :return: A dictionary with all values present in this object.
        """
        if not self.settings.cache_enabled:
            return utils.to_dict_from_fields(self, self.get_fields())

        value = self.get_from_cache(self)
        if value is None:
            value = utils.to_dict_from_fields(self, self.get_fields())
        self.set_cache(self, value)
        return value
Пример #2
0
    def to_dict(self):
        # return utils.to_dict_from_fields(self, self.get_fields())

        value = self.get_from_cache(self)
        if value is None:
            value = utils.to_dict_from_fields(self, self.get_fields())
        self.set_cache(self, value)
        return value
Пример #3
0
    def to_dict(self):
        # return utils.to_dict_from_fields(self, self.get_fields())

        value = self.get_from_cache(self)
        if value is None:
            value = utils.to_dict_from_fields(self, self.get_fields())
        self.set_cache(self, value)
        return value
Пример #4
0
    def to_dict(self) -> dict:
        """
        This converts everything in this object to a dictionary.

        :return: A dictionary with all values present in this object.
        """
        if not self.settings.cache_enabled:
            return utils.to_dict_from_fields(self, self.get_fields())

        value = self.get_from_cache(self)
        if value is None:
            value = utils.to_dict_from_fields(self, self.get_fields())
        self.set_cache(self, value)
        if "autoinstall" in value:
            value.update({"kickstart": value["autoinstall"]})
        if "autoinstall_meta" in value:
            value.update({"ks_meta": value["autoinstall_meta"]})
        return value
Пример #5
0
def test_to_dict_from_fields():
    # Arrange
    test_api = CobblerAPI()
    test_distro = Distro(test_api._collection_mgr)

    # Act
    result = utils.to_dict_from_fields(test_distro, test_distro.get_fields())

    # Assert - This test is specific to a Distro object
    assert len(result.keys()) == 25
Пример #6
0
 def to_dict(self):
     return utils.to_dict_from_fields(self, self.get_fields())
Пример #7
0
 def to_dict(self):
     return utils.to_dict_from_fields(self, self.get_fields())