velocity-python 0.0.120__py3-none-any.whl → 0.0.121__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.
Potentially problematic release.
This version of velocity-python might be problematic. Click here for more details.
- velocity/__init__.py +1 -1
- velocity/aws/handlers/base_handler.py +9 -6
- velocity/aws/handlers/lambda_handler.py +12 -1
- velocity/aws/handlers/sqs_handler.py +8 -2
- {velocity_python-0.0.120.dist-info → velocity_python-0.0.121.dist-info}/METADATA +1 -1
- {velocity_python-0.0.120.dist-info → velocity_python-0.0.121.dist-info}/RECORD +9 -9
- {velocity_python-0.0.120.dist-info → velocity_python-0.0.121.dist-info}/WHEEL +0 -0
- {velocity_python-0.0.120.dist-info → velocity_python-0.0.121.dist-info}/licenses/LICENSE +0 -0
- {velocity_python-0.0.120.dist-info → velocity_python-0.0.121.dist-info}/top_level.txt +0 -0
velocity/__init__.py
CHANGED
|
@@ -116,11 +116,12 @@ class BaseHandler:
|
|
|
116
116
|
|
|
117
117
|
return actions
|
|
118
118
|
|
|
119
|
-
def execute_actions(self, local_context, actions: List[str]) -> bool:
|
|
119
|
+
def execute_actions(self, tx, local_context, actions: List[str]) -> bool:
|
|
120
120
|
"""
|
|
121
121
|
Execute the appropriate actions for the given context.
|
|
122
122
|
|
|
123
123
|
Args:
|
|
124
|
+
tx: Database transaction object
|
|
124
125
|
local_context: The context object
|
|
125
126
|
actions: List of action method names to try
|
|
126
127
|
|
|
@@ -129,7 +130,7 @@ class BaseHandler:
|
|
|
129
130
|
"""
|
|
130
131
|
# Execute beforeAction hook if available
|
|
131
132
|
if hasattr(self, "beforeAction"):
|
|
132
|
-
self.beforeAction(local_context)
|
|
133
|
+
self.beforeAction(tx, local_context)
|
|
133
134
|
|
|
134
135
|
action_executed = False
|
|
135
136
|
|
|
@@ -139,7 +140,7 @@ class BaseHandler:
|
|
|
139
140
|
break
|
|
140
141
|
|
|
141
142
|
if hasattr(self, action):
|
|
142
|
-
result = getattr(self, action)(local_context)
|
|
143
|
+
result = getattr(self, action)(tx, local_context)
|
|
143
144
|
|
|
144
145
|
# Check for deprecated return values (LambdaHandler specific)
|
|
145
146
|
if result is not None and hasattr(self, "_check_deprecated_return"):
|
|
@@ -150,27 +151,29 @@ class BaseHandler:
|
|
|
150
151
|
|
|
151
152
|
# Execute afterAction hook if available
|
|
152
153
|
if hasattr(self, "afterAction"):
|
|
153
|
-
self.afterAction(local_context)
|
|
154
|
+
self.afterAction(tx, local_context)
|
|
154
155
|
|
|
155
156
|
return action_executed
|
|
156
157
|
|
|
157
|
-
def handle_error(self, local_context, exception: Exception):
|
|
158
|
+
def handle_error(self, tx, local_context, exception: Exception):
|
|
158
159
|
"""
|
|
159
160
|
Handle errors that occur during action execution.
|
|
160
161
|
|
|
161
162
|
Args:
|
|
163
|
+
tx: Database transaction object
|
|
162
164
|
local_context: The context object
|
|
163
165
|
exception: The exception that occurred
|
|
164
166
|
"""
|
|
165
167
|
if hasattr(self, "onError"):
|
|
166
168
|
self.onError(
|
|
169
|
+
tx,
|
|
167
170
|
local_context,
|
|
168
171
|
exc=exception.__class__.__name__,
|
|
169
172
|
tb=traceback.format_exc(),
|
|
170
173
|
)
|
|
171
174
|
else:
|
|
172
175
|
# Re-raise if no error handler is defined
|
|
173
|
-
raise
|
|
176
|
+
raise exception
|
|
174
177
|
|
|
175
178
|
def log(self, tx, message: str, function: Optional[str] = None):
|
|
176
179
|
"""
|
|
@@ -71,8 +71,19 @@ class LambdaHandler(BaseHandler):
|
|
|
71
71
|
log=lambda message, function=None: self.log(tx, message, function),
|
|
72
72
|
)
|
|
73
73
|
|
|
74
|
+
# Determine action from postdata or query parameters
|
|
75
|
+
action = postdata.get("action") or req_params.get("action")
|
|
76
|
+
|
|
77
|
+
# Get the list of actions to execute
|
|
78
|
+
actions = self.get_actions_to_execute(action)
|
|
79
|
+
|
|
74
80
|
# Use BaseHandler's execute_actions method
|
|
75
|
-
|
|
81
|
+
try:
|
|
82
|
+
self.execute_actions(tx, local_context, actions)
|
|
83
|
+
except Exception as e:
|
|
84
|
+
self.handle_error(tx, local_context, e)
|
|
85
|
+
|
|
86
|
+
return local_context.response
|
|
76
87
|
|
|
77
88
|
def track(self, tx, data={}, user=None):
|
|
78
89
|
data = data.copy()
|
|
@@ -78,11 +78,17 @@ class SqsHandler(BaseHandler):
|
|
|
78
78
|
session=None,
|
|
79
79
|
)
|
|
80
80
|
|
|
81
|
+
# Determine action from postdata
|
|
82
|
+
action = postdata.get("action") if isinstance(postdata, dict) else None
|
|
83
|
+
|
|
84
|
+
# Get the list of actions to execute
|
|
85
|
+
actions = self.get_actions_to_execute(action)
|
|
86
|
+
|
|
81
87
|
# Use BaseHandler's execute_actions method
|
|
82
88
|
try:
|
|
83
|
-
self.execute_actions(tx, local_context,
|
|
89
|
+
self.execute_actions(tx, local_context, actions)
|
|
84
90
|
except Exception as e:
|
|
85
|
-
self.handle_error(local_context, e)
|
|
91
|
+
self.handle_error(tx, local_context, e)
|
|
86
92
|
|
|
87
93
|
def OnActionDefault(self, tx, context):
|
|
88
94
|
"""
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
velocity/__init__.py,sha256=
|
|
1
|
+
velocity/__init__.py,sha256=DfMCazsqNZhPsSZjZY5RiEr71GHu3IVu9BH-bhpKOd0,147
|
|
2
2
|
velocity/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
velocity/app/invoices.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
velocity/app/orders.py,sha256=fr1oTBjSFfyeMBUXRG06LV4jgwrlwYNL5mbEBleFwf0,6328
|
|
@@ -7,12 +7,12 @@ velocity/app/purchase_orders.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
7
7
|
velocity/aws/__init__.py,sha256=0nEsX68Q4I7Z7ybECJnNWsC8QhWOijn4NpaFgyzyfXA,685
|
|
8
8
|
velocity/aws/amplify.py,sha256=VgSgon0XxboIozz0tKyUohgLIigelhe4W7EH8kwbnLg,15330
|
|
9
9
|
velocity/aws/handlers/__init__.py,sha256=4-NKj8dBzjYEdIlNdfm_Ip5mI0oOGcpjjBcMwU42yhQ,227
|
|
10
|
-
velocity/aws/handlers/base_handler.py,sha256=
|
|
10
|
+
velocity/aws/handlers/base_handler.py,sha256=bapdzWss5lXesoLPsVwJo9hQMZLdz7XOubo3sK70xC8,7960
|
|
11
11
|
velocity/aws/handlers/context.py,sha256=UGp8X7w4zUXsJ5uAteE-kTZYCclisz42nIO8mPu6Eg8,8384
|
|
12
12
|
velocity/aws/handlers/exceptions.py,sha256=i4wcB8ZSWUHglX2xnesDlWLsU9AMYU72cHCWRBDmjQ8,361
|
|
13
|
-
velocity/aws/handlers/lambda_handler.py,sha256=
|
|
13
|
+
velocity/aws/handlers/lambda_handler.py,sha256=eRm7qah8C2z8k7XeTcm_4_i4UK5qJVybgt27OwG8ewA,4420
|
|
14
14
|
velocity/aws/handlers/response.py,sha256=s2Kw7yv5zAir1mEmfv6yBVIvRcRQ__xyryf1SrvtiRc,9317
|
|
15
|
-
velocity/aws/handlers/sqs_handler.py,sha256=
|
|
15
|
+
velocity/aws/handlers/sqs_handler.py,sha256=azuV8DrFOh0hM13EnPzyYVBS-3fLe2fn9OPc4ho7sGc,3375
|
|
16
16
|
velocity/db/__init__.py,sha256=7XRUHY2af0HL1jvL0SAMpxSe5a2Phbkm-YLJCvC1C_0,739
|
|
17
17
|
velocity/db/exceptions.py,sha256=XHREJvzNctrtYE-ScBRLnbk7thxTswkfWojKhMmBmd8,2185
|
|
18
18
|
velocity/db/utils.py,sha256=IoXeAL_0wZE15gbxlb2TtNdHzUSV9bIvw8jNkqjz38o,7020
|
|
@@ -50,8 +50,8 @@ velocity/misc/tools.py,sha256=4TWa-ja2gMZJr1EhqTKsJNirvDclCruyRGMttPhCIGw,1487
|
|
|
50
50
|
velocity/misc/conv/__init__.py,sha256=qhHFl_UqW5tjPm--6shO171IysWIdH3mmp3uwiQVyqY,70
|
|
51
51
|
velocity/misc/conv/iconv.py,sha256=16aPWtreHCxmpl5ufku0KWWZj8PIUFI5J1dP0aXyM3o,10794
|
|
52
52
|
velocity/misc/conv/oconv.py,sha256=h5Lo05DqOQnxoD3y6Px_MQP_V-pBbWf8Hkgkb9Xp1jk,6032
|
|
53
|
-
velocity_python-0.0.
|
|
54
|
-
velocity_python-0.0.
|
|
55
|
-
velocity_python-0.0.
|
|
56
|
-
velocity_python-0.0.
|
|
57
|
-
velocity_python-0.0.
|
|
53
|
+
velocity_python-0.0.121.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
|
|
54
|
+
velocity_python-0.0.121.dist-info/METADATA,sha256=_uy6dABYdHgUSFLbujtMlkyZZ5s7y3VSDX352Df_rWU,34262
|
|
55
|
+
velocity_python-0.0.121.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
56
|
+
velocity_python-0.0.121.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
|
|
57
|
+
velocity_python-0.0.121.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|