Bastien Sevajol 6 anni fa
parent
commit
57708de917
2 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. 4 0
      hapic/decorator.py
  2. 12 0
      hapic/hapic.py

+ 4 - 0
hapic/decorator.py Vedi File

@@ -337,6 +337,10 @@ class AsyncOutputBodyControllerWrapper(OutputControllerWrapper):
337 337
 
338 338
 
339 339
 class AsyncOutputStreamControllerWrapper(OutputControllerWrapper):
340
+    """
341
+    This controller wrapper produce a wrapper who caught the http view items
342
+    to check and serialize them into a stream response.
343
+    """
340 344
     def get_wrapper(
341 345
         self,
342 346
         func: 'typing.Callable[..., typing.Any]',

+ 12 - 0
hapic/hapic.py Vedi File

@@ -180,6 +180,18 @@ class Hapic(object):
180 180
         error_http_code: HTTPStatus = HTTPStatus.INTERNAL_SERVER_ERROR,
181 181
         default_http_code: HTTPStatus = HTTPStatus.OK,
182 182
     ) -> typing.Callable[[typing.Callable[..., typing.Any]], typing.Any]:
183
+        """
184
+        Decorate with a wrapper who check and serialize each items in output
185
+        stream.
186
+
187
+        :param item_schema: Schema of output stream items
188
+        :param processor: ProcessorInterface object to process with given
189
+        schema
190
+        :param context: Context to use here
191
+        :param error_http_code: http code in case of error
192
+        :param default_http_code: http code in case of success
193
+        :return: decorator
194
+        """
183 195
         processor = processor or MarshmallowOutputProcessor()
184 196
         processor.schema = item_schema
185 197
         context = context or self._context_getter