Browse Source

update todos

Bastien Sevajol 6 years ago
parent
commit
f02e003ba8
6 changed files with 26 additions and 33 deletions
  1. 4 0
      README.md
  2. 2 6
      hapic/context.py
  3. 6 7
      hapic/decorator.py
  4. 5 5
      hapic/doc.py
  5. 7 13
      hapic/hapic.py
  6. 2 2
      setup.py

+ 4 - 0
README.md View File

@@ -4,3 +4,7 @@ Input/Output/Error management for your python controllers with Swagger doc gener
4 4
 ## Presentation
5 5
 
6 6
 Hapic is in unstable and development mode. More information soon.
7
+
8
+## TODO references
9
+
10
+TODO can make reference to #X, this is github issues references.

+ 2 - 6
hapic/context.py View File

@@ -29,7 +29,7 @@ class ContextInterface(object):
29 29
         raise NotImplementedError()
30 30
 
31 31
 
32
-# TODO: In extension
32
+# TODO: In extension, see #3
33 33
 class BottleContext(ContextInterface):
34 34
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
35 35
         return RequestParameters(
@@ -58,7 +58,7 @@ class BottleContext(ContextInterface):
58 58
         error: ProcessValidationError,
59 59
         http_code: HTTPStatus=HTTPStatus.BAD_REQUEST,
60 60
     ) -> typing.Any:
61
-        # TODO
61
+        # TODO BS 20171010: Manage error schemas, see #4
62 62
         from hapic.hapic import _default_global_error_schema
63 63
         unmarshall = _default_global_error_schema.dump(error)
64 64
         if unmarshall.errors:
@@ -75,7 +75,3 @@ class BottleContext(ContextInterface):
75 75
             ],
76 76
             status=int(http_code),
77 77
         )
78
-
79
-    # FIXME: Pas generique, marche pas en plus :'(
80
-    def get_app(self):
81
-        return bottle.default_app()

+ 6 - 7
hapic/decorator.py View File

@@ -3,7 +3,7 @@ import functools
3 3
 import typing
4 4
 from http import HTTPStatus
5 5
 
6
-# TODO BS 20171010: bottle specific !
6
+# TODO BS 20171010: bottle specific !  # see #5
7 7
 from bottle import HTTPResponse
8 8
 
9 9
 from hapic.data import HapicData
@@ -14,7 +14,7 @@ from hapic.processor import ProcessorInterface
14 14
 from hapic.processor import RequestParameters
15 15
 
16 16
 # TODO: Ensure usage of DECORATION_ATTRIBUTE_NAME is documented and
17
-# var names correctly choose.
17
+# var names correctly choose.  see #6
18 18
 DECORATION_ATTRIBUTE_NAME = '_hapic_decoration_token'
19 19
 
20 20
 
@@ -127,7 +127,7 @@ class InputControllerWrapper(InputOutputControllerWrapper):
127 127
         cls,
128 128
         func_kwargs: typing.Dict[str, typing.Any],
129 129
     ) -> HapicData:
130
-        # TODO: Permit other name than "hapic_data" ?
130
+        # TODO: Permit other name than "hapic_data" ? see #7
131 131
         try:
132 132
             return func_kwargs['hapic_data']
133 133
         except KeyError:
@@ -211,7 +211,7 @@ class OutputControllerWrapper(InputOutputControllerWrapper):
211 211
             return prepared_response
212 212
         except ProcessException:
213 213
             # TODO: ici ou ailleurs: il faut pas forcement donner le detail
214
-            # de l'erreur (mode debug par exemple)
214
+            # de l'erreur (mode debug par exemple)  see #8
215 215
             error_response = self.get_error_response(response)
216 216
             return error_response
217 217
 
@@ -245,7 +245,6 @@ class OutputBodyControllerWrapper(OutputControllerWrapper):
245 245
 
246 246
 
247 247
 class OutputHeadersControllerWrapper(OutputControllerWrapper):
248
-    # TODO: write me
249 248
     pass
250 249
 
251 250
 
@@ -364,8 +363,8 @@ class ExceptionHandlerControllerWrapper(ControllerWrapper):
364 363
                 func_kwargs,
365 364
             )
366 365
         except self.handled_exception_class as exc:
367
-            # TODO: error_dict configurable name
368
-            # TODO: Who assume error structure ? We have to rethink it
366
+            # TODO: error_dict configurable name, see #4
367
+            # TODO: Who assume error structure ? We have to rethink it, see #4
369 368
             error_dict = {
370 369
                 'error_message': str(exc),
371 370
             }

+ 5 - 5
hapic/doc.py View File

@@ -21,7 +21,7 @@ def find_bottle_route(
21 21
     app: bottle.Bottle,
22 22
 ):
23 23
     if not app.routes:
24
-        # TODO BS 20171010: specialize exception
24
+        # TODO BS 20171010: specialize exception, see #9
25 25
         raise Exception('There is no routes in yout bottle app')
26 26
 
27 27
     reference = decorated_controller.reference
@@ -38,8 +38,8 @@ def find_bottle_route(
38 38
 
39 39
         if match_with_wrapper or match_with_wrapped or match_with_token:
40 40
             return route
41
-    # TODO BS 20171010: specialize exception
42
-    # TODO BS 20171010: Raise exception or print error ?
41
+    # TODO BS 20171010: specialize exception, see #9
42
+    # TODO BS 20171010: Raise exception or print error ? see #10
43 43
     raise Exception(
44 44
         'Decorated route "{}" was not found in bottle routes'.format(
45 45
             decorated_controller.name,
@@ -119,8 +119,8 @@ class DocGenerator(object):
119 119
         controllers: typing.List[DecoratedController],
120 120
         app,
121 121
     ) -> dict:
122
-        # TODO: Découper
123
-        # TODO: bottle specific code !
122
+        # TODO: Découper, see #11
123
+        # TODO: bottle specific code !, see #11
124 124
         if not app:
125 125
             app = bottle.default_app()
126 126
         else:

+ 7 - 13
hapic/hapic.py View File

@@ -31,20 +31,15 @@ from hapic.processor import ProcessorInterface
31 31
 from hapic.processor import MarshmallowInputProcessor
32 32
 from hapic.processor import MarshmallowOutputProcessor
33 33
 
34
-# TODO: Gérer les erreurs avec schema
35
-# TODO: Gérer les erreurs avec schema: pouvoir le spécialiser
36
-# TODO: Gérer les cas ou c'est une liste la réponse (items, item_nb)
37
-# TODO: Confusion nommage body/json/forms
34
+# TODO: Gérer les cas ou c'est une liste la réponse (items, item_nb), see #12
35
+# TODO: Confusion nommage body/json/forms, see #13
38 36
 
39 37
 # _waiting = {}
40 38
 # _endpoints = {}
41
-# FIXME: Voir
42 39
 class ErrorResponseSchema(marshmallow.Schema):
43 40
     error_message = marshmallow.fields.String(required=True)
44
-
45
-
46 41
     error_details = marshmallow.fields.Dict(required=True)
47
-# FIXME: C'est un gros gros fake !
42
+
48 43
 _default_global_error_schema = ErrorResponseSchema()
49 44
 
50 45
 
@@ -62,7 +57,7 @@ class Hapic(object):
62 57
 
63 58
         self._context_getter = context_getter
64 59
 
65
-        # TODO: Permettre la surcharge des classes utilisés ci-dessous
60
+        # TODO: Permettre la surcharge des classes utilisés ci-dessous, see #14
66 61
 
67 62
     @property
68 63
     def controllers(self) -> typing.List[DecoratedController]:
@@ -74,8 +69,6 @@ class Hapic(object):
74 69
 
75 70
     def with_api_doc(self):
76 71
         def decorator(func):
77
-
78
-            # FIXME: casse ou casse pas le bis ?
79 72
             @functools.wraps(func)
80 73
             def wrapper(*args, **kwargs):
81 74
                 return func(*args, **kwargs)
@@ -292,8 +285,9 @@ class Hapic(object):
292 285
             return decoration.get_wrapper(func)
293 286
         return decorator
294 287
 
295
-    def generate_doc(self, app):  # FIXME: j'ai du tricher avec app
296
-        # FIXME @Damien bottle specific code !
288
+    def generate_doc(self, app):
289
+        # FIXME: j'ai du tricher avec app, see #11
290
+        # FIXME @Damien bottle specific code ! see #11
297 291
         # rendre ca generique
298 292
         app = app or self._context.get_app()
299 293
         doc_generator = DocGenerator()

+ 2 - 2
setup.py View File

@@ -7,8 +7,8 @@ from os import path
7 7
 here = path.abspath(path.dirname(__file__))
8 8
 
9 9
 install_requires = [
10
-    # TODO: Bottle will be an extension in future
11
-    # TODO: marshmallow an extension too ?
10
+    # TODO: Bottle will be an extension in future, see #1
11
+    # TODO: marshmallow an extension too ? see #2
12 12
     'bottle',
13 13
     'marshmallow',
14 14
     'apispec',