Example #1
0
    def add_sink(self, sink, prefix=r'/'):
        if not iscoroutinefunction(sink) and is_python_func(sink):
            if _should_wrap_non_coroutines():
                sink = wrap_sync_to_async(sink)
            else:
                raise CompatibilityError(
                    'The sink method must be an awaitable coroutine function '
                    'in order to be used safely with an ASGI app.')

        super().add_sink(sink, prefix=prefix)
Example #2
0
 def let(responder=responder):
     method_map[method] = wrap_sync_to_async(responder)