velocity-python 0.0.16__tar.gz → 0.0.17__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.

Potentially problematic release.


This version of velocity-python might be problematic. Click here for more details.

Files changed (45) hide show
  1. {velocity-python-0.0.16 → velocity-python-0.0.17}/PKG-INFO +1 -1
  2. {velocity-python-0.0.16 → velocity-python-0.0.17}/pyproject.toml +1 -1
  3. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/__init__.py +1 -1
  4. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/handlers/context.py +20 -11
  5. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/handlers/lambda_handler.py +20 -16
  6. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/handlers/sqs_handler.py +5 -4
  7. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity_python.egg-info/PKG-INFO +1 -1
  8. {velocity-python-0.0.16 → velocity-python-0.0.17}/LICENSE +0 -0
  9. {velocity-python-0.0.16 → velocity-python-0.0.17}/README.md +0 -0
  10. {velocity-python-0.0.16 → velocity-python-0.0.17}/setup.cfg +0 -0
  11. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/__init__.py +0 -0
  12. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/handlers/__init__.py +0 -0
  13. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/aws/handlers/response.py +0 -0
  14. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/__init__.py +0 -0
  15. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/__init__.py +0 -0
  16. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/column.py +0 -0
  17. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/database.py +0 -0
  18. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/decorators.py +0 -0
  19. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/engine.py +0 -0
  20. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/exceptions.py +0 -0
  21. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/result.py +0 -0
  22. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/row.py +0 -0
  23. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/sequence.py +0 -0
  24. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/table.py +0 -0
  25. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/core/transaction.py +0 -0
  26. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/__init__.py +0 -0
  27. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/mysql.py +0 -0
  28. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/postgres.py +0 -0
  29. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/sql.py +0 -0
  30. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/sqlite.py +0 -0
  31. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/db/servers/sqlserver.py +0 -0
  32. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/__init__.py +0 -0
  33. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/conv/__init__.py +0 -0
  34. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/conv/iconv.py +0 -0
  35. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/conv/oconv.py +0 -0
  36. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/db.py +0 -0
  37. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/export.py +0 -0
  38. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/format.py +0 -0
  39. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/mail.py +0 -0
  40. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/merge.py +0 -0
  41. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity/misc/timer.py +0 -0
  42. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity_python.egg-info/SOURCES.txt +0 -0
  43. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity_python.egg-info/dependency_links.txt +0 -0
  44. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity_python.egg-info/requires.txt +0 -0
  45. {velocity-python-0.0.16 → velocity-python-0.0.17}/src/velocity_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: velocity-python
3
- Version: 0.0.16
3
+ Version: 0.0.17
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Paul Perez <pperez@codeclubs.org>
6
6
  Project-URL: Homepage, https://codeclubs.org/projects/velocity
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "velocity-python"
3
- version = "0.0.16"
3
+ version = "0.0.17"
4
4
  authors = [
5
5
  { name="Paul Perez", email="pperez@codeclubs.org" },
6
6
  ]
@@ -1,4 +1,4 @@
1
- __version__ = version = "0.0.16"
1
+ __version__ = version = "0.0.17"
2
2
 
3
3
  from . import aws
4
4
  from . import db
@@ -2,9 +2,11 @@ import support.app
2
2
 
3
3
  engine = support.app.postgres()
4
4
 
5
+
5
6
  @engine.transaction
6
7
  class Context:
7
- def __init__(self, args, postdata, response, aws_event, session, aws_context):
8
+
9
+ def __init__(self, aws_event, aws_context, args, postdata, response, session):
8
10
  self.__args = args
9
11
  self.__postdata = postdata
10
12
  self.__response = response
@@ -12,10 +14,9 @@ class Context:
12
14
  self.__aws_event = aws_event
13
15
  self.__aws_context = aws_context
14
16
 
15
-
16
17
  def postdata(self, keys=-1, default=None):
17
18
  if keys == -1:
18
- return self.__postdata
19
+ return self.__postdata
19
20
  if not isinstance(keys, list):
20
21
  keys = [keys]
21
22
  data = self.__postdata
@@ -25,22 +26,30 @@ class Context:
25
26
  else:
26
27
  return default
27
28
  return data
28
-
29
-
29
+
30
30
  def payload(self, keys=-1, default={}):
31
- if 'payload' not in self.__postdata:
32
- return default
31
+ if "payload" not in self.__postdata:
32
+ return default
33
33
  if keys == -1:
34
- return self.__postdata['payload']
34
+ return self.__postdata["payload"]
35
35
  if not isinstance(keys, list):
36
36
  keys = [keys]
37
- data = self.__postdata['payload']
37
+ data = self.__postdata["payload"]
38
38
  for key in keys:
39
39
  if key in data:
40
40
  data = data[key]
41
41
  else:
42
42
  return default
43
43
  return data
44
-
44
+
45
45
  def action(self):
46
- return self.__postdata('action', self.__args('action', ''))
46
+ return self.__postdata.get("action", self.__args.get("action", ""))
47
+
48
+ def args(self):
49
+ return self.__args
50
+
51
+ def response(self):
52
+ return self.__response
53
+
54
+ def session(self):
55
+ return self.__session
@@ -8,12 +8,15 @@ from support.app import helpers, AlertError, enqueue
8
8
 
9
9
  from velocity.aws.handlers import Response
10
10
 
11
+ from . import context
12
+
13
+
11
14
  class LambdaHandler:
12
15
  def __init__(self, aws_event, aws_context):
13
16
  self.aws_event = aws_event
14
17
  self.aws_context = aws_context
15
- self.serve_action_default = True # Set to False to disable OnActionDefault
16
- self.skip_action = False # Set to True to skip all actions
18
+ self.serve_action_default = True # Set to False to disable OnActionDefault
19
+ self.skip_action = False # Set to True to skip all actions
17
20
 
18
21
  requestContext = aws_event.get("requestContext") or {}
19
22
  identity = requestContext.get("identity") or {}
@@ -75,7 +78,7 @@ class LambdaHandler:
75
78
 
76
79
  def serve(self, tx):
77
80
  response = Response()
78
- body = self.event.get("body")
81
+ body = self.aws_event.get("body")
79
82
  postdata = {}
80
83
  if isinstance(body, str) and len(body) > 0:
81
84
  try:
@@ -91,17 +94,18 @@ class LambdaHandler:
91
94
  except:
92
95
  postdata = {"raw_body": body}
93
96
 
94
- req_params = self.event.get("queryStringParameters") or {}
95
- context = Context(
96
- args=req_params,
97
- postdata=postdata,
98
- response=response,
99
- event=self.aws_event,
100
- session=self.session,
101
- aws_context=self.aws_context)
97
+ req_params = self.aws_event.get("queryStringParameters") or {}
98
+ local_context = context.Context(
99
+ aws_event=self.aws_event,
100
+ aws_context=self.aws_context,
101
+ args=req_params,
102
+ postdata=postdata,
103
+ response=response,
104
+ session=self.session,
105
+ )
102
106
  try:
103
107
  if hasattr(self, "beforeAction"):
104
- self.beforeAction(context)
108
+ self.beforeAction(local_context)
105
109
  actions = []
106
110
  action = postdata.get("action", req_params.get("action"))
107
111
  if action:
@@ -116,19 +120,19 @@ class LambdaHandler:
116
120
  if self.skip_action:
117
121
  break
118
122
  if hasattr(self, action):
119
- result = getattr(self, action)(context)
123
+ result = getattr(self, action)(local_context)
120
124
  if result and result != response:
121
125
  response.set_body(result)
122
126
  break
123
127
  if hasattr(self, "afterAction"):
124
- self.afterAction(context)
128
+ self.afterAction(local_context)
125
129
  except AlertError as e:
126
130
  response.alert(e.get_payload())
127
131
  except Exception as e:
128
132
  response.exception()
129
133
  if hasattr(self, "onError"):
130
134
  self.onError(
131
- context,
135
+ local_context,
132
136
  exc=e.__class__.__name__,
133
137
  tb=traceback.format_exc(),
134
138
  )
@@ -155,4 +159,4 @@ class LambdaHandler:
155
159
  self.track(tx, postdata.get("payload", {}).get("data", {}))
156
160
 
157
161
  def enqueue(self, tx, action, payload={}):
158
- return enqueue(tx, action, payload, self.session["email_address"])
162
+ return enqueue(tx, action, payload, self.session["email_address"])
@@ -5,9 +5,10 @@ import os
5
5
  import traceback
6
6
  from velocity.aws import DEBUG
7
7
 
8
+
8
9
  class SqsHandler:
9
- def __init__(self, event, aws_context):
10
- self.event = event
10
+ def __init__(self, aws_event, aws_context):
11
+ self.aws_event = aws_event
11
12
  self.aws_context = aws_context
12
13
  self.serve_action_default = True
13
14
  self.skip_action = False
@@ -39,7 +40,7 @@ class SqsHandler:
39
40
  tx.table("sys_log").insert(data)
40
41
 
41
42
  def serve(self, tx):
42
- records = self.event.get("Records", [])
43
+ records = self.aws_event.get("Records", [])
43
44
  for record in records:
44
45
  attrs = record.get("attributes")
45
46
  try:
@@ -82,4 +83,4 @@ class SqsHandler:
82
83
  attrs: {str(attrs)}
83
84
  postdata: {str(postdata)}
84
85
  """
85
- )
86
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: velocity-python
3
- Version: 0.0.16
3
+ Version: 0.0.17
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Paul Perez <pperez@codeclubs.org>
6
6
  Project-URL: Homepage, https://codeclubs.org/projects/velocity