tiferet 1.0.0a9__py3-none-any.whl → 1.0.0a10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiferet/__init__.py +5 -1
- tiferet/contexts/__init__.py +7 -2
- tiferet/contexts/app.py +6 -6
- tiferet/contexts/error.py +8 -9
- {tiferet-1.0.0a9.dist-info → tiferet-1.0.0a10.dist-info}/METADATA +1 -1
- {tiferet-1.0.0a9.dist-info → tiferet-1.0.0a10.dist-info}/RECORD +9 -9
- {tiferet-1.0.0a9.dist-info → tiferet-1.0.0a10.dist-info}/LICENSE +0 -0
- {tiferet-1.0.0a9.dist-info → tiferet-1.0.0a10.dist-info}/WHEEL +0 -0
- {tiferet-1.0.0a9.dist-info → tiferet-1.0.0a10.dist-info}/top_level.txt +0 -0
tiferet/__init__.py
CHANGED
tiferet/contexts/__init__.py
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# *** imports
|
2
|
+
|
3
|
+
# ** app
|
1
4
|
from .app import AppInterfaceContext
|
2
|
-
from .
|
3
|
-
from .error import ErrorContext
|
5
|
+
from .container import ContainerContext
|
6
|
+
from .error import ErrorContext
|
7
|
+
from .feature import FeatureContext
|
8
|
+
from .request import RequestContext
|
tiferet/contexts/app.py
CHANGED
@@ -118,7 +118,7 @@ class AppInterfaceContext(Model):
|
|
118
118
|
import json
|
119
119
|
|
120
120
|
# Return the response.
|
121
|
-
return json.loads(request.result)
|
121
|
+
return json.loads(request.result) if request.result else ''
|
122
122
|
|
123
123
|
# * method: run
|
124
124
|
def run(self, **kwargs):
|
@@ -134,11 +134,11 @@ class AppInterfaceContext(Model):
|
|
134
134
|
|
135
135
|
# Execute feature context and return session.
|
136
136
|
# Handle error and return response if triggered.
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
return
|
137
|
+
try:
|
138
|
+
self.execute_feature(request, **kwargs)
|
139
|
+
except Exception as e:
|
140
|
+
print('Error:', e)
|
141
|
+
return self.errors.handle_error(e)
|
142
142
|
|
143
143
|
# Handle response.
|
144
144
|
return self.handle_response(request)
|
tiferet/contexts/error.py
CHANGED
@@ -42,25 +42,24 @@ class ErrorContext(Model):
|
|
42
42
|
self.validate()
|
43
43
|
|
44
44
|
# * method: handle_error
|
45
|
-
def handle_error(self,
|
45
|
+
def handle_error(self, exception: Exception, lang: str = 'en_US', **kwargs) -> Tuple[bool, Any]:
|
46
46
|
'''
|
47
47
|
Handle an error.
|
48
48
|
|
49
|
-
:param
|
50
|
-
:type
|
49
|
+
:param exception: The exception to handle.
|
50
|
+
:type exception: Exception
|
51
|
+
:param lang: The language to use for the error message.
|
52
|
+
:type lang: str
|
51
53
|
:return: Whether the error was handled.
|
52
54
|
:rtype: bool
|
53
55
|
'''
|
54
56
|
|
55
57
|
# Execute the feature function and handle the errors.
|
56
|
-
|
57
|
-
|
58
|
-
return (False, None)
|
59
|
-
except AssertionError as e:
|
60
|
-
return (True, self.format_error_response(str(e)))
|
58
|
+
if isinstance(exception, AssertionError):
|
59
|
+
return self.format_error_response(str(exception), lang, **kwargs)
|
61
60
|
|
62
61
|
# * method: format_error_response
|
63
|
-
def format_error_response(self, error_message: str, lang: str
|
62
|
+
def format_error_response(self, error_message: str, lang: str, **kwargs) -> Any:
|
64
63
|
'''
|
65
64
|
Format the error response.
|
66
65
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tiferet/__init__.py,sha256=
|
1
|
+
tiferet/__init__.py,sha256=1CDYADhNKmHqE4yYf7RgcQcNQm34FTRR2w4WTzbm2Rk,70
|
2
2
|
tiferet/clients/__init__.py,sha256=hSa_PgXM2jw9iVRrJH_SQUlSVISK-T4tTfgRKnXKkzA,33
|
3
3
|
tiferet/clients/yaml.py,sha256=790LB7CpaMow_Ng8zB6jGmJnoqz8xjMYbfDLeMd4o3Q,2816
|
4
4
|
tiferet/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -6,10 +6,10 @@ tiferet/commands/container.py,sha256=L2IKJqEbRglw_LC144oYAkARr2Rixj8IFuC6Ro1jAqA
|
|
6
6
|
tiferet/commands/error.py,sha256=ixMYH0yrEWlMAVGDSRke3IGoWaOShfmiXntrUC2b3wY,573
|
7
7
|
tiferet/commands/feature.py,sha256=tXa-MDf14ByIJqwQFeSUu2QLUjHPdsyvFNhj1XeaQVk,2507
|
8
8
|
tiferet/configs/__init__.py,sha256=NfT6XFNcJznOLXjMuNmj3XeaOPVWwbc-N4kVWaVjuD0,845
|
9
|
-
tiferet/contexts/__init__.py,sha256=
|
10
|
-
tiferet/contexts/app.py,sha256=
|
9
|
+
tiferet/contexts/__init__.py,sha256=HjI-9n29mFxN6ILSa3LBhLSVPRe-1V36ffQXSP9RavM,204
|
10
|
+
tiferet/contexts/app.py,sha256=9VxWliIX_Y0Y8CZXQzYLgzN89MabkFzkW2e7-3P5KrQ,3781
|
11
11
|
tiferet/contexts/container.py,sha256=WXg_PsZQOIfZWW8rNj0NTTg3bLJUjIRGhIGgENzJfxE,5175
|
12
|
-
tiferet/contexts/error.py,sha256=
|
12
|
+
tiferet/contexts/error.py,sha256=mS72JU7rlxs9yEeDj5ZW3DuJftYqmkyp8DOhzNUwtMw,2562
|
13
13
|
tiferet/contexts/feature.py,sha256=FgHgk3xz3jpQUPynfX7uw9GmhV5wpHRHLtYWvKkkEwE,2979
|
14
14
|
tiferet/contexts/request.py,sha256=EwTyXVYi8z1t1ns_0yDrjY6qICIMPn1UvZpV7ULKReY,2756
|
15
15
|
tiferet/data/__init__.py,sha256=JKaeCw508WY15-etqdFJxPUUJxMxCAi6ASmA472D1_s,93
|
@@ -31,8 +31,8 @@ tiferet/repos/feature.py,sha256=GxOV8XHNwz9YY3I8Wch6GaDskvkdi8l1hM9E9fCg1y0,3644
|
|
31
31
|
tiferet/services/__init__.py,sha256=zB5elAFApNH435JLExPmWxvBmZcCtbAyai-KawUjr4E,101
|
32
32
|
tiferet/services/app.py,sha256=92GvC-Vh8FDZoYMLdgzQ3iS1TVL4uyIErk7NJ4rpYPI,1462
|
33
33
|
tiferet/services/container.py,sha256=ISJhkiNLV--nHbAv6Ajd3ug1cGiyazZoePJOCJu5n_s,1130
|
34
|
-
tiferet-1.0.
|
35
|
-
tiferet-1.0.
|
36
|
-
tiferet-1.0.
|
37
|
-
tiferet-1.0.
|
38
|
-
tiferet-1.0.
|
34
|
+
tiferet-1.0.0a10.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
|
35
|
+
tiferet-1.0.0a10.dist-info/METADATA,sha256=sy6HMZIH1CaR7AfNqilSRhMlI-keX5clnGBV5rimESw,419
|
36
|
+
tiferet-1.0.0a10.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
37
|
+
tiferet-1.0.0a10.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
|
38
|
+
tiferet-1.0.0a10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|