コード例 #1
0
    def get_implementation(self):
        """
        Creates an instance of the class corresponding to the protocol identifier,
        bound with this repository. If the class cannot be found
        in the :data:`~deposit.registry.protocol_registry`, `None` is returned.

        :returns: an instance of the class corresponding to the value of the `protocol` field.
        """
        cls = protocol_registry.get(self.protocol)
        if cls is None:
            logger.warning("Protocol not found: " + str(self.protocol))
            return
        return cls(self)
コード例 #2
0
ファイル: models.py プロジェクト: Phyks/dissemin
    def get_implementation(self):
        """
        Creates an instance of the class corresponding to the protocol identifier,
        bound with this repository. If the class cannot be found
        in the :data:`~deposit.registry.protocol_registry`, `None` is returned.

        :returns: the class corresponding to the value of the `protocol` field.
        """
        cls = protocol_registry.get(self.protocol)
        if cls is None:
            logger.warning("Protocol not found: "+str(self.protocol))
            return
        return cls(self)
コード例 #3
0
ファイル: tests.py プロジェクト: tarsbase/dissemin
 def test_get(self):
     c = protocol_registry.get('ZenodoProtocol')
     self.assertTrue(issubclass(c, RepositoryProtocol))
コード例 #4
0
ファイル: test_protocol.py プロジェクト: rgrunbla/dissemin
 def test_protocol_registered(self):
     """
     This test makes sure that each tested protocol is registered. You can temporarly override this function in your corresponding protocol test as long as you do not have it registered.
     """
     p = protocol_registry.get(self.protocol.__class__.__name__)
     assert issubclass(p, RepositoryProtocol) == True
コード例 #5
0
ファイル: test_protocol.py プロジェクト: Phyks/dissemin
 def test_get(self):
     c = protocol_registry.get('ZenodoProtocol')
     self.assertTrue(issubclass(c, RepositoryProtocol))