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
 ## Presentation
4
 ## Presentation
5
 
5
 
6
 Hapic is in unstable and development mode. More information soon.
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
         raise NotImplementedError()
29
         raise NotImplementedError()
30
 
30
 
31
 
31
 
32
-# TODO: In extension
32
+# TODO: In extension, see #3
33
 class BottleContext(ContextInterface):
33
 class BottleContext(ContextInterface):
34
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
34
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
35
         return RequestParameters(
35
         return RequestParameters(
58
         error: ProcessValidationError,
58
         error: ProcessValidationError,
59
         http_code: HTTPStatus=HTTPStatus.BAD_REQUEST,
59
         http_code: HTTPStatus=HTTPStatus.BAD_REQUEST,
60
     ) -> typing.Any:
60
     ) -> typing.Any:
61
-        # TODO
61
+        # TODO BS 20171010: Manage error schemas, see #4
62
         from hapic.hapic import _default_global_error_schema
62
         from hapic.hapic import _default_global_error_schema
63
         unmarshall = _default_global_error_schema.dump(error)
63
         unmarshall = _default_global_error_schema.dump(error)
64
         if unmarshall.errors:
64
         if unmarshall.errors:
75
             ],
75
             ],
76
             status=int(http_code),
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
 import typing
3
 import typing
4
 from http import HTTPStatus
4
 from http import HTTPStatus
5
 
5
 
6
-# TODO BS 20171010: bottle specific !
6
+# TODO BS 20171010: bottle specific !  # see #5
7
 from bottle import HTTPResponse
7
 from bottle import HTTPResponse
8
 
8
 
9
 from hapic.data import HapicData
9
 from hapic.data import HapicData
14
 from hapic.processor import RequestParameters
14
 from hapic.processor import RequestParameters
15
 
15
 
16
 # TODO: Ensure usage of DECORATION_ATTRIBUTE_NAME is documented and
16
 # TODO: Ensure usage of DECORATION_ATTRIBUTE_NAME is documented and
17
-# var names correctly choose.
17
+# var names correctly choose.  see #6
18
 DECORATION_ATTRIBUTE_NAME = '_hapic_decoration_token'
18
 DECORATION_ATTRIBUTE_NAME = '_hapic_decoration_token'
19
 
19
 
20
 
20
 
127
         cls,
127
         cls,
128
         func_kwargs: typing.Dict[str, typing.Any],
128
         func_kwargs: typing.Dict[str, typing.Any],
129
     ) -> HapicData:
129
     ) -> HapicData:
130
-        # TODO: Permit other name than "hapic_data" ?
130
+        # TODO: Permit other name than "hapic_data" ? see #7
131
         try:
131
         try:
132
             return func_kwargs['hapic_data']
132
             return func_kwargs['hapic_data']
133
         except KeyError:
133
         except KeyError:
211
             return prepared_response
211
             return prepared_response
212
         except ProcessException:
212
         except ProcessException:
213
             # TODO: ici ou ailleurs: il faut pas forcement donner le detail
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
             error_response = self.get_error_response(response)
215
             error_response = self.get_error_response(response)
216
             return error_response
216
             return error_response
217
 
217
 
245
 
245
 
246
 
246
 
247
 class OutputHeadersControllerWrapper(OutputControllerWrapper):
247
 class OutputHeadersControllerWrapper(OutputControllerWrapper):
248
-    # TODO: write me
249
     pass
248
     pass
250
 
249
 
251
 
250
 
364
                 func_kwargs,
363
                 func_kwargs,
365
             )
364
             )
366
         except self.handled_exception_class as exc:
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
             error_dict = {
368
             error_dict = {
370
                 'error_message': str(exc),
369
                 'error_message': str(exc),
371
             }
370
             }

+ 5 - 5
hapic/doc.py View File

21
     app: bottle.Bottle,
21
     app: bottle.Bottle,
22
 ):
22
 ):
23
     if not app.routes:
23
     if not app.routes:
24
-        # TODO BS 20171010: specialize exception
24
+        # TODO BS 20171010: specialize exception, see #9
25
         raise Exception('There is no routes in yout bottle app')
25
         raise Exception('There is no routes in yout bottle app')
26
 
26
 
27
     reference = decorated_controller.reference
27
     reference = decorated_controller.reference
38
 
38
 
39
         if match_with_wrapper or match_with_wrapped or match_with_token:
39
         if match_with_wrapper or match_with_wrapped or match_with_token:
40
             return route
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
     raise Exception(
43
     raise Exception(
44
         'Decorated route "{}" was not found in bottle routes'.format(
44
         'Decorated route "{}" was not found in bottle routes'.format(
45
             decorated_controller.name,
45
             decorated_controller.name,
119
         controllers: typing.List[DecoratedController],
119
         controllers: typing.List[DecoratedController],
120
         app,
120
         app,
121
     ) -> dict:
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
         if not app:
124
         if not app:
125
             app = bottle.default_app()
125
             app = bottle.default_app()
126
         else:
126
         else:

+ 7 - 13
hapic/hapic.py View File

31
 from hapic.processor import MarshmallowInputProcessor
31
 from hapic.processor import MarshmallowInputProcessor
32
 from hapic.processor import MarshmallowOutputProcessor
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
 # _waiting = {}
37
 # _waiting = {}
40
 # _endpoints = {}
38
 # _endpoints = {}
41
-# FIXME: Voir
42
 class ErrorResponseSchema(marshmallow.Schema):
39
 class ErrorResponseSchema(marshmallow.Schema):
43
     error_message = marshmallow.fields.String(required=True)
40
     error_message = marshmallow.fields.String(required=True)
44
-
45
-
46
     error_details = marshmallow.fields.Dict(required=True)
41
     error_details = marshmallow.fields.Dict(required=True)
47
-# FIXME: C'est un gros gros fake !
42
+
48
 _default_global_error_schema = ErrorResponseSchema()
43
 _default_global_error_schema = ErrorResponseSchema()
49
 
44
 
50
 
45
 
62
 
57
 
63
         self._context_getter = context_getter
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
     @property
62
     @property
68
     def controllers(self) -> typing.List[DecoratedController]:
63
     def controllers(self) -> typing.List[DecoratedController]:
74
 
69
 
75
     def with_api_doc(self):
70
     def with_api_doc(self):
76
         def decorator(func):
71
         def decorator(func):
77
-
78
-            # FIXME: casse ou casse pas le bis ?
79
             @functools.wraps(func)
72
             @functools.wraps(func)
80
             def wrapper(*args, **kwargs):
73
             def wrapper(*args, **kwargs):
81
                 return func(*args, **kwargs)
74
                 return func(*args, **kwargs)
292
             return decoration.get_wrapper(func)
285
             return decoration.get_wrapper(func)
293
         return decorator
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
         # rendre ca generique
291
         # rendre ca generique
298
         app = app or self._context.get_app()
292
         app = app or self._context.get_app()
299
         doc_generator = DocGenerator()
293
         doc_generator = DocGenerator()

+ 2 - 2
setup.py View File

7
 here = path.abspath(path.dirname(__file__))
7
 here = path.abspath(path.dirname(__file__))
8
 
8
 
9
 install_requires = [
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
     'bottle',
12
     'bottle',
13
     'marshmallow',
13
     'marshmallow',
14
     'apispec',
14
     'apispec',