tiferet 1.0.0a9__tar.gz → 1.0.0a10__tar.gz

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.
Files changed (44) hide show
  1. {tiferet-1.0.0a9/tiferet.egg-info → tiferet-1.0.0a10}/PKG-INFO +1 -1
  2. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/setup.py +1 -1
  3. tiferet-1.0.0a10/tiferet/__init__.py +5 -0
  4. tiferet-1.0.0a10/tiferet/contexts/__init__.py +8 -0
  5. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/contexts/app.py +6 -6
  6. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/contexts/error.py +8 -9
  7. {tiferet-1.0.0a9 → tiferet-1.0.0a10/tiferet.egg-info}/PKG-INFO +1 -1
  8. tiferet-1.0.0a9/tiferet/__init__.py +0 -1
  9. tiferet-1.0.0a9/tiferet/contexts/__init__.py +0 -3
  10. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/LICENSE +0 -0
  11. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/setup.cfg +0 -0
  12. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/clients/__init__.py +0 -0
  13. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/clients/yaml.py +0 -0
  14. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/commands/__init__.py +0 -0
  15. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/commands/container.py +0 -0
  16. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/commands/error.py +0 -0
  17. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/commands/feature.py +0 -0
  18. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/configs/__init__.py +0 -0
  19. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/contexts/container.py +0 -0
  20. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/contexts/feature.py +0 -0
  21. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/contexts/request.py +0 -0
  22. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/data/__init__.py +0 -0
  23. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/data/app.py +0 -0
  24. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/data/container.py +0 -0
  25. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/data/error.py +0 -0
  26. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/data/feature.py +0 -0
  27. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/__init__.py +0 -0
  28. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/app.py +0 -0
  29. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/container.py +0 -0
  30. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/core.py +0 -0
  31. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/error.py +0 -0
  32. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/domain/feature.py +0 -0
  33. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/repos/__init__.py +0 -0
  34. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/repos/app.py +0 -0
  35. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/repos/container.py +0 -0
  36. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/repos/error.py +0 -0
  37. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/repos/feature.py +0 -0
  38. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/services/__init__.py +0 -0
  39. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/services/app.py +0 -0
  40. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet/services/container.py +0 -0
  41. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet.egg-info/SOURCES.txt +0 -0
  42. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet.egg-info/dependency_links.txt +0 -0
  43. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet.egg-info/requires.txt +0 -0
  44. {tiferet-1.0.0a9 → tiferet-1.0.0a10}/tiferet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a9
3
+ Version: 1.0.0a10
4
4
  Summary: A multi-purpose application framework embodying beauty in form.
5
5
  Home-page: https://github.com/greatstrength/app
6
6
  Download-URL: https://github.com/greatstrength/app
@@ -9,7 +9,7 @@ config = {
9
9
  'url': r'https://github.com/greatstrength/app',
10
10
  'download_url': r'https://github.com/greatstrength/app',
11
11
  'author_email': 'andrew@greatstrength.me',
12
- 'version': '1.0.0-alpha.9',
12
+ 'version': '1.0.0-alpha.10',
13
13
  'license': 'BSD 3',
14
14
  'install_requires': [
15
15
  'schematics>=2.1.1',
@@ -0,0 +1,5 @@
1
+ # *** imports
2
+
3
+ # ** app
4
+ from .contexts import *
5
+ from .domain import *
@@ -0,0 +1,8 @@
1
+ # *** imports
2
+
3
+ # ** app
4
+ from .app import AppInterfaceContext
5
+ from .container import ContainerContext
6
+ from .error import ErrorContext
7
+ from .feature import FeatureContext
8
+ from .request import RequestContext
@@ -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
- has_error, message = self.errors.handle_error(lambda: self.execute_feature(request, **kwargs))
138
-
139
- # Handle error if present.
140
- if has_error:
141
- return message
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)
@@ -42,25 +42,24 @@ class ErrorContext(Model):
42
42
  self.validate()
43
43
 
44
44
  # * method: handle_error
45
- def handle_error(self, execute_feature: Any) -> Tuple[bool, Any]:
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 func: The execute feature function to handle.
50
- :type func: function
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
- try:
57
- execute_feature()
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 = 'en_US', **kwargs) -> Any:
62
+ def format_error_response(self, error_message: str, lang: str, **kwargs) -> Any:
64
63
  '''
65
64
  Format the error response.
66
65
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a9
3
+ Version: 1.0.0a10
4
4
  Summary: A multi-purpose application framework embodying beauty in form.
5
5
  Home-page: https://github.com/greatstrength/app
6
6
  Download-URL: https://github.com/greatstrength/app
@@ -1 +0,0 @@
1
- from .contexts import *
@@ -1,3 +0,0 @@
1
- from .app import AppInterfaceContext
2
- from .request import RequestContext
3
- from .error import ErrorContext
File without changes
File without changes