示例#1
0
 def _build_definition(self):
     try:
         return self._request_definition_builder.build()
     except exceptions.InvalidRequestDefinition as error:
         # TODO: Find a Python 2.7 compatible way to reraise
         raise exceptions.UplinkBuilderError(self._owner_name,
                                             self._attr_name, error)
示例#2
0
    def build(self, consumer, definition):
        """
        Returns a callable to replace the definition on the given
        consumer instance.
        """

        try:
            definition = definition.build()
        except exceptions.InvalidRequestDefinition as error:
            # TODO: Find a Python 2.7 compatible way to reraise
            raise exceptions.UplinkBuilderError(consumer.__class__,
                                                definition.__name__, error)

        return CallFactory(consumer, RequestPreparer(self, definition),
                           definition)