Browse Source

Merge branch 'develop' of github.com:algoo/hapic into fix/57_support_for_additionals_fields_for_query_path_params

Guénaël Muller 6 years ago
parent
commit
9b668ba692
6 changed files with 23 additions and 4 deletions
  1. 1 0
      .gitignore
  2. 1 0
      hapic/__init__.py
  3. 4 1
      hapic/context.py
  4. 4 1
      hapic/ext/pyramid/context.py
  5. 2 0
      hapic/infos.py
  6. 11 2
      setup.py

+ 1 - 0
.gitignore View File

8
 .coverage
8
 .coverage
9
 /build
9
 /build
10
 /dist
10
 /dist
11
+make_hapic_release

+ 1 - 0
hapic/__init__.py View File

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
 from hapic.hapic import Hapic
2
 from hapic.hapic import Hapic
3
 from hapic.data import HapicData
3
 from hapic.data import HapicData
4
+from hapic.infos import __version__
4
 
5
 
5
 __version__ = '0.41'
6
 __version__ = '0.41'
6
 _hapic_default = Hapic()
7
 _hapic_default = Hapic()

+ 4 - 1
hapic/context.py View File

202
                     # TODO BS 2018-05-04: How to be attentive to hierarchy ?
202
                     # TODO BS 2018-05-04: How to be attentive to hierarchy ?
203
                     if isinstance(exc, handled_exception.exception_class):
203
                     if isinstance(exc, handled_exception.exception_class):
204
                         error_builder = self.get_default_error_builder()
204
                         error_builder = self.get_default_error_builder()
205
-                        error_body = error_builder.build_from_exception(exc)
205
+                        error_body = error_builder.build_from_exception(
206
+                            exc,
207
+                            include_traceback=self.is_debug(),
208
+                        )
206
                         return self.get_response(
209
                         return self.get_response(
207
                             json.dumps(error_body),
210
                             json.dumps(error_body),
208
                             handled_exception.http_code,
211
                             handled_exception.http_code,

+ 4 - 1
hapic/ext/pyramid/context.py View File

194
             def view_func(exc, request):
194
             def view_func(exc, request):
195
                 # TODO BS 2018-05-04: How to be attentive to hierarchy ?
195
                 # TODO BS 2018-05-04: How to be attentive to hierarchy ?
196
                 error_builder = self.get_default_error_builder()
196
                 error_builder = self.get_default_error_builder()
197
-                error_body = error_builder.build_from_exception(exc)
197
+                error_body = error_builder.build_from_exception(
198
+                    exc,
199
+                    include_traceback=self.is_debug(),
200
+                )
198
                 return self.get_response(
201
                 return self.get_response(
199
                     json.dumps(error_body),
202
                     json.dumps(error_body),
200
                     http_code
203
                     http_code

+ 2 - 0
hapic/infos.py View File

1
+# -*- coding: utf-8 -*-
2
+__version__ = '0.41'

+ 11 - 2
setup.py View File

5
 from os import path
5
 from os import path
6
 import sys
6
 import sys
7
 
7
 
8
+# INFO - G.M - 29-05-2018 - exec info.py file in order to obtain version
9
+# without any dependencies trouble.
10
+# see https://milkr.io/kfei/5-common-patterns-to-version-your-Python-package
11
+# section "Exec/execfile" for other example and "Import from the package" for
12
+# information about import strategy problem.
13
+infos_dict = {}
14
+with open("hapic/infos.py") as fp:
15
+    exec(fp.read(), infos_dict)
16
+version = infos_dict['__version__']
17
+
8
 here = path.abspath(path.dirname(__file__))
18
 here = path.abspath(path.dirname(__file__))
9
 
19
 
10
 install_requires = [
20
 install_requires = [
35
     # Versions should comply with PEP440.  For a discussion on single-sourcing
45
     # Versions should comply with PEP440.  For a discussion on single-sourcing
36
     # the version across setup.py and the project code, see
46
     # the version across setup.py and the project code, see
37
     # https://packaging.python.org/en/latest/single_source_version.html
47
     # https://packaging.python.org/en/latest/single_source_version.html
38
-    version=hapic.__version__,
39
-
48
+    version=version,
40
     description='HTTP api input/output manager',
49
     description='HTTP api input/output manager',
41
     # long_description=long_description,
50
     # long_description=long_description,
42
     long_description='',
51
     long_description='',