瀏覽代碼

Add comments

Guénaël Muller 6 年之前
父節點
當前提交
1232e971c7
共有 1 個文件被更改,包括 18 次插入2 次删除
  1. 18 2
      hapic/hapic.py

+ 18 - 2
hapic/hapic.py 查看文件

423
             description=description,
423
             description=description,
424
         )
424
         )
425
 
425
 
426
-        def spec_yaml_view( *args, **kwargs):
426
+        def spec_yaml_view(*args, **kwargs):
427
+            """
428
+            Method to return swagger generated yaml spec file.
429
+
430
+            This method will be call as a framework view, like those,
431
+            it need to handle the default arguments of a framework view.
432
+            As frameworks have different arguments patterns, we should
433
+            allow any arguments patterns (args, kwargs).
434
+            """
427
             return self.context.get_response(
435
             return self.context.get_response(
428
                 doc_yaml,
436
                 doc_yaml,
429
                 mimetype='text/x-yaml',
437
                 mimetype='text/x-yaml',
441
 
449
 
442
         # Declare the swaggerui view
450
         # Declare the swaggerui view
443
         def api_doc_view(*args, **kwargs):
451
         def api_doc_view(*args, **kwargs):
452
+            """
453
+            Method to return html index view of swagger ui.
454
+
455
+            This method will be call as a framework view, like those,
456
+            it need to handle the default arguments of a framework view.
457
+            As frameworks have different arguments patterns, we should
458
+            allow any arguments patterns (args, kwargs).
459
+            """
444
             return self.context.get_response(
460
             return self.context.get_response(
445
                 doc_page_content,
461
                 doc_page_content,
446
                 http_code=HTTPStatus.OK,
462
                 http_code=HTTPStatus.OK,
447
                 mimetype='text/html',
463
                 mimetype='text/html',
448
             )
464
             )
449
 
465
 
450
-        # Add a view to generate the html index page of swaggerui
466
+        # Add a view to generate the html index page of swagger-ui
451
         self.context.add_view(
467
         self.context.add_view(
452
             route=route,
468
             route=route,
453
             http_method='GET',
469
             http_method='GET',