iris-pex-embedded-python 2.3.27b2__py3-none-any.whl → 3.2.1b3__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 iris-pex-embedded-python might be problematic. Click here for more details.

Files changed (85) hide show
  1. grongier/cls/Grongier/PEX/BusinessOperation.cls +1 -28
  2. grongier/cls/Grongier/PEX/BusinessProcess.cls +1 -100
  3. grongier/cls/Grongier/PEX/BusinessService.cls +1 -28
  4. grongier/cls/Grongier/PEX/Common.cls +1 -194
  5. grongier/cls/Grongier/PEX/Director.cls +1 -48
  6. grongier/cls/Grongier/PEX/Duplex/Operation.cls +1 -26
  7. grongier/cls/Grongier/PEX/Duplex/Process.cls +1 -217
  8. grongier/cls/Grongier/PEX/Duplex/Service.cls +1 -6
  9. grongier/cls/Grongier/PEX/InboundAdapter.cls +1 -15
  10. grongier/cls/Grongier/PEX/Message.cls +1 -116
  11. grongier/cls/Grongier/PEX/OutboundAdapter.cls +1 -29
  12. grongier/cls/Grongier/PEX/PickleMessage.cls +1 -46
  13. grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +1 -253
  14. grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +1 -19
  15. grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +1 -19
  16. grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +1 -19
  17. grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +1 -35
  18. grongier/cls/Grongier/PEX/Test.cls +1 -53
  19. grongier/cls/Grongier/PEX/Utils.cls +1 -365
  20. grongier/cls/Grongier/Service/WSGI.cls +1 -307
  21. grongier/pex/__init__.py +11 -11
  22. grongier/pex/__main__.py +1 -1
  23. grongier/pex/_business_host.py +1 -511
  24. grongier/pex/_cli.py +2 -150
  25. grongier/pex/_common.py +1 -347
  26. grongier/pex/_director.py +1 -286
  27. grongier/pex/_utils.py +1 -369
  28. intersystems_iris/_ConnectionInformation.py +22 -20
  29. intersystems_iris/dbapi/_DBAPI.py +6 -1
  30. intersystems_iris/dbapi/_ResultSetRow.py +26 -15
  31. intersystems_iris/dbapi/preparser/_PreParser.py +4 -1
  32. iop/__init__.py +24 -0
  33. iop/__main__.py +4 -0
  34. iop/_business_host.py +675 -0
  35. iop/_business_operation.py +71 -0
  36. iop/_business_process.py +220 -0
  37. {grongier/pex → iop}/_business_service.py +2 -2
  38. iop/_cli.py +196 -0
  39. iop/_common.py +352 -0
  40. iop/_director.py +301 -0
  41. {grongier/pex → iop}/_inbound_adapter.py +1 -1
  42. iop/_log_manager.py +81 -0
  43. {grongier/pex → iop}/_message.py +1 -1
  44. {grongier/pex → iop}/_outbound_adapter.py +1 -1
  45. {grongier/pex → iop}/_private_session_duplex.py +3 -2
  46. {grongier/pex → iop}/_private_session_process.py +2 -2
  47. iop/_utils.py +458 -0
  48. iop/cls/IOP/BusinessOperation.cls +35 -0
  49. iop/cls/IOP/BusinessProcess.cls +124 -0
  50. iop/cls/IOP/BusinessService.cls +35 -0
  51. iop/cls/IOP/Common.cls +344 -0
  52. iop/cls/IOP/Director.cls +62 -0
  53. iop/cls/IOP/Duplex/Operation.cls +29 -0
  54. iop/cls/IOP/Duplex/Process.cls +229 -0
  55. iop/cls/IOP/Duplex/Service.cls +9 -0
  56. iop/cls/IOP/InboundAdapter.cls +22 -0
  57. iop/cls/IOP/Message/JSONSchema.cls +125 -0
  58. iop/cls/IOP/Message.cls +729 -0
  59. iop/cls/IOP/OutboundAdapter.cls +36 -0
  60. iop/cls/IOP/PickleMessage.cls +58 -0
  61. iop/cls/IOP/PrivateSession/Duplex.cls +260 -0
  62. iop/cls/IOP/PrivateSession/Message/Ack.cls +32 -0
  63. iop/cls/IOP/PrivateSession/Message/Poll.cls +32 -0
  64. iop/cls/IOP/PrivateSession/Message/Start.cls +32 -0
  65. iop/cls/IOP/PrivateSession/Message/Stop.cls +48 -0
  66. iop/cls/IOP/Service/WSGI.cls +310 -0
  67. iop/cls/IOP/Test.cls +85 -0
  68. iop/cls/IOP/Utils.cls +378 -0
  69. iop/wsgi/handlers.py +104 -0
  70. iris_pex_embedded_python-3.2.1b3.dist-info/METADATA +90 -0
  71. iris_pex_embedded_python-3.2.1b3.dist-info/RECORD +139 -0
  72. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/WHEEL +1 -1
  73. iris_pex_embedded_python-3.2.1b3.dist-info/entry_points.txt +2 -0
  74. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/top_level.txt +1 -1
  75. grongier/pex/_business_operation.py +0 -70
  76. grongier/pex/_business_process.py +0 -215
  77. iris/__init__.py +0 -60
  78. iris/__init__.pyi +0 -236
  79. iris/iris_ipm.py +0 -40
  80. iris/iris_ipm.pyi +0 -17
  81. iris_pex_embedded_python-2.3.27b2.dist-info/METADATA +0 -1384
  82. iris_pex_embedded_python-2.3.27b2.dist-info/RECORD +0 -113
  83. iris_pex_embedded_python-2.3.27b2.dist-info/entry_points.txt +0 -2
  84. {grongier/pex → iop}/_pickle_message.py +0 -0
  85. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/LICENSE +0 -0
@@ -1,310 +1,4 @@
1
- Class Grongier.Service.WSGI Extends %CSP.REST [ ServerOnly = 1 ]
1
+ Class Grongier.Service.WSGI Extends IOP.Service.WSGI [ ServerOnly = 1 ]
2
2
  {
3
3
 
4
- Parameter CLASSPATHS;
5
-
6
- Parameter MODULENAME;
7
-
8
- Parameter APPNAME;
9
-
10
- Parameter DEVMODE = 1;
11
-
12
- /// This method matches the request and method and calls the dispatcher
13
- ClassMethod Page(skipheader As %Boolean = 0) As %Status [ ProcedureBlock = 1 ]
14
- {
15
- #dim tSC As %Status = $$$OK
16
- #dim e As %Exception.AbstractException
17
-
18
- #dim tAuthorized,tRedirected As %Boolean
19
- #dim tRedirectRoutine,tURL As %String = ""
20
- #dim %response As %CSP.Response
21
-
22
- Try {
23
-
24
- #; Ensure that we honor the requested charset
25
- Set %response.CharSet=..#CHARSET
26
-
27
- #; Ensure that we honor the requested CONTENTTYPE
28
- If ..#CONTENTTYPE'="" Set %response.ContentType=..#CONTENTTYPE
29
-
30
- #; Ensure that we honor the requested HTTP_ACCEPT_LANGUAGE
31
- Set %response.Domain = ..#DOMAIN
32
- Do %response.MatchLanguage()
33
-
34
-
35
-
36
- #; Record if device re-direction is already active
37
- Set tRedirected=##class(%Library.Device).ReDirectIO()
38
-
39
- #; Record the redirect routine
40
- Set tRedirectRoutine=$System.Device.GetMnemonicRoutine()
41
-
42
- #; Now switch to using THIS routine for device redirection
43
- Use $io::("^%SYS.cspServer2")
44
-
45
- #; Switch device redirection on (may already be on but thats ok)
46
- Do ##class(%Library.Device).ReDirectIO(1)
47
-
48
- #; Ensure that the application is defined (security check)
49
- If $$$GetSecurityApplicationsDispatchClass(%request.AppData)="" {
50
-
51
- #; Report not authorized
52
- Set tSC=..Http403()
53
-
54
- #; Done
55
- Quit
56
- }
57
-
58
- #; GgiEnvs are not defined in the CSP shell
59
- Set tURL=$Get(%request.CgiEnvs("CSPLIB"))
60
- If tURL="" Set tURL=%request.URL
61
-
62
- #; Do an access check
63
- Set tSC=..AccessCheck(.tAuthorized)
64
- If $$$ISERR(tSC) Quit
65
-
66
- If tAuthorized=0 {
67
-
68
- #; Don't want the session token
69
- Set %response.OutputSessionToken=0
70
-
71
- #; Set the Http Status
72
- Set %response.Status=..#HTTP403FORBIDDEN
73
-
74
- #; Done
75
- Quit
76
- }
77
-
78
- #; Extract the match url from the application name
79
- Set tMatchUrl = "/"_$Extract(tURL,$Length(%request.Application)+1,*)
80
-
81
- #; Dispatch the request
82
- Set tSC=..DispatchRequest(tMatchUrl,%request.Method)
83
-
84
- } Catch (e) {
85
- Set tSC=e.AsStatus()
86
- }
87
-
88
- If $$$ISERR(tSC) {
89
-
90
- #; Don't want the session token
91
- Set %response.OutputSessionToken=0
92
-
93
- Do ..Http500(##class(%Exception.StatusException).CreateFromStatus(tSC))
94
- }
95
-
96
- #; Ensure that at least something is written out as the body
97
- #; This will trigger the device redirect capture and force headers to be written
98
- #; (if not already done)
99
- Write ""
100
-
101
- #; Reset redirect device if necessary
102
- If tRedirected {
103
-
104
- #; Use the original redirected routine
105
- Use $io::("^"_tRedirectRoutine)
106
-
107
- #; Switch device redirection on
108
- Do ##class(%Library.Device).ReDirectIO(1)
109
- }
110
-
111
- if ..#DEVMODE {
112
- #; Close the device to ensure next request starts with a new process
113
- Close 0
114
- }
115
-
116
- Quit $$$OK
117
- }
118
-
119
- ClassMethod OnPreDispatch(
120
- pUrl As %String,
121
- pMethod As %String,
122
- ByRef pContinue As %Boolean) As %Status
123
- {
124
- Set path = ..#CLASSPATHS
125
- Set appName = ..#APPNAME
126
- Set module = ..#MODULENAME
127
- Set devmode = ..#DEVMODE
128
- Set pContinue = 1
129
- Do ..DispatchREST(pUrl, path, appName, module, devmode)
130
- Quit $$$OK
131
- }
132
-
133
- ClassMethod DispatchREST(
134
- PathInfo As %String,
135
- appPath As %String,
136
- appName As %String,
137
- module As %String,
138
- devmode As %Boolean = 1) As %Status
139
- {
140
- Set builtins = ##CLASS(%SYS.Python).Builtins()
141
- Set interface = ##CLASS(%SYS.Python).Import("grongier.pex.wsgi.handlers")
142
- Set rawformdata = ""
143
- Set environ = builtins.dict()
144
- Set key = %request.NextCgiEnv("")
145
-
146
- // Let's check if the WSGI application has been loaded or not for this session.
147
-
148
- If (($DATA(%session.Data("application")) && $ISOBJECT(%session.Data("application"))) && 'devmode) {
149
- Set application = %session.Data("Application")
150
- }
151
- Else{
152
-
153
- Set application = ..GetPythonClass(appName, module, appPath)
154
- If application = "" {
155
- throw ##class(%Exception.General).%New("Error loading WSGI application: "_module_"."_appName_" from "_appPath)
156
- }
157
- Else {
158
- Set %session.Data("Application") = application
159
- }
160
- }
161
-
162
- // Editing some CGI variables that may be incorrect in %request
163
- // Also filling in environ with as many CGI variables as possible from %request
164
- // WSGI states that all CGI variables are valid and should be included if possible
165
- While (key'="") {
166
- Set value = %request.GetCgiEnv(key)
167
- If key = "PATH_INFO" {
168
- Set app=$$getapp^%SYS.cspServer(%request.URL,.path,.match,.updatedurl)
169
- Set value = $EXTRACT(updatedurl,$LENGTH(path),*)
170
- }
171
- If key = "SCRIPT_NAME" {
172
- //%request will sometimes have Script_name include Path_info
173
- Set value = $PIECE(%request.Application, "/",1,*-1)
174
- }
175
- Do environ."__setitem__"(key,value)
176
- Set key = %request.NextCgiEnv(key)
177
- }
178
-
179
- //Have to set up a correct wsgi.input stream from %request
180
- Set stream = %request.Content
181
-
182
- Set contentType = %request.ContentType
183
- Set contentLength = 0
184
-
185
- If contentType = "application/x-www-form-urlencoded" {
186
- Set formdict = builtins.dict()
187
- Set key = $ORDER(%request.Data(""))
188
- While (key'="") {
189
- Set value = $GET(%request.Data(key,1))
190
- Do formdict."__setitem__"(key,value)
191
- Set key = $ORDER(%request.Data(key))
192
- }
193
- Do environ."__setitem__"("formdata", formdict)
194
- }
195
- ElseIf contentType = "multipart/form-data" {
196
- Set boundary = $PIECE(%request.GetCgiEnv("CONTENT_TYPE"), "=",2)
197
- Set stream = ##CLASS(%CSP.BinaryStream).%New()
198
-
199
- Do stream.Write($CHAR(13,10))
200
-
201
- //Get the Form Data values
202
-
203
- Set key = $ORDER(%request.Data(""))
204
- While (key'="") {
205
- Do stream.Write("--")
206
- Do stream.Write(boundary)
207
- Do stream.Write($CHAR(13,10))
208
- Set value = $GET(%request.Data(key,1))
209
- Do stream.Write("Content-Disposition: form-data; name=")
210
- Do stream.Write(""""_key_"""")
211
- Do stream.Write($CHAR(13,10,13,10))
212
- Do stream.Write(value)
213
- Do stream.Write($CHAR(13,10))
214
- Set key = $ORDER(%request.Data(key))
215
- }
216
-
217
- //Now get the possible MIME data streams
218
- Set key = %request.NextMimeData("")
219
- While key'="" {
220
- Set numMimeStreams = %request.CountMimeData(key)
221
- Set index = %request.NextMimeDataIndex(key, "")
222
- Do stream.Write("--")
223
- Do stream.Write(boundary)
224
- Do stream.Write($CHAR(13,10))
225
- If numMimeStreams > 1 {
226
- //I need to create a boundary for a nested multipart content type
227
- Set internalboundary = "--"
228
- For i = 1 : 1 : 7 {
229
- Set internalboundary = internalboundary _ $RANDOM(10)
230
- }
231
- While index '= "" {
232
- Set mimestream = %request.GetMimeData(key, index)
233
- Set headers = mimestream.Headers
234
- Do stream.Write("--")
235
- Do stream.Write(internalboundary)
236
- Do stream.Write($CHAR(13,10))
237
- Do stream.Write(headers)
238
- Do stream.Write($CHAR(13,10,13,10))
239
- Set sc = stream.CopyFrom(mimestream)
240
- //TODO error handling
241
- Do stream.Write($CHAR(13,10))
242
- Set index = %request.NextMimeDataIndex(key, index)
243
- }
244
- Do stream.Write("--")
245
- Do stream.Write(internalboundary)
246
- Do stream.Write("--")
247
- }
248
- Else {
249
- Set mimestream = %request.GetMimeData(key, index)
250
- Set headers = mimestream.Headers
251
- Do stream.Write(headers)
252
- Do stream.Write($CHAR(13,10,13,10))
253
- Set sc = stream.CopyFrom(mimestream)
254
- //TODO error handling
255
- Do stream.Write($CHAR(13,10))
256
- }
257
- Set key = %request.NextMimeData(key)
258
- }
259
- Do stream.Write("--")
260
- Do stream.Write(boundary)
261
- Do stream.Write("--")
262
- Do stream.Rewind()
263
- }
264
-
265
-
266
- Try {
267
- Do interface."make_request"(environ, stream, application, appPath)
268
- }
269
- Catch exception {
270
- throw exception
271
- }
272
- Quit $$$OK
273
- }
274
-
275
- ClassMethod GetPythonClass(
276
- pClassname As %String,
277
- pModule As %String,
278
- pClasspath As %String) As %SYS.Python
279
- {
280
- Try {
281
- If pClasspath '="" {
282
- set sys = ##class(%SYS.Python).Import("sys")
283
-
284
- for i=0:1:(sys.path."__len__"()-1) {
285
- Try {
286
- if sys.path."__getitem__"(i) = pClasspath {
287
- do sys.path."__delitem__"(i)
288
- }
289
- }
290
- Catch ex {
291
- // do nothing
292
- }
293
-
294
- }
295
- do sys.path.insert(0, pClasspath)
296
- }
297
-
298
- Set importlib = ##class(%SYS.Python).Import("importlib")
299
- Set builtins = ##class(%SYS.Python).Import("builtins")
300
- Set module = importlib."import_module"(pModule)
301
- Set class = builtins.getattr(module, pClassname)
302
- }
303
- Catch ex {
304
- throw ##class(%Exception.General).%New("Error loading WSGI application: "_pModule_"."_pClassname_" from "_pClasspath)
305
- }
306
-
307
- Quit class
308
- }
309
-
310
4
  }
grongier/pex/__init__.py CHANGED
@@ -1,14 +1,14 @@
1
- from grongier.pex._business_service import _BusinessService
2
- from grongier.pex._business_process import _BusinessProcess
3
- from grongier.pex._private_session_duplex import _PrivateSessionDuplex
4
- from grongier.pex._private_session_process import _PrivateSessionProcess
5
- from grongier.pex._business_operation import _BusinessOperation
6
- from grongier.pex._inbound_adapter import _InboundAdapter
7
- from grongier.pex._outbound_adapter import _OutboundAdapter
8
- from grongier.pex._message import _Message
9
- from grongier.pex._pickle_message import _PickleMessage
10
- from grongier.pex._director import _Director
11
- from grongier.pex._utils import _Utils
1
+ from iop._business_service import _BusinessService
2
+ from iop._business_process import _BusinessProcess
3
+ from iop._private_session_duplex import _PrivateSessionDuplex
4
+ from iop._private_session_process import _PrivateSessionProcess
5
+ from iop._business_operation import _BusinessOperation
6
+ from iop._inbound_adapter import _InboundAdapter
7
+ from iop._outbound_adapter import _OutboundAdapter
8
+ from iop._message import _Message
9
+ from iop._pickle_message import _PickleMessage
10
+ from iop._director import _Director
11
+ from iop._utils import _Utils
12
12
 
13
13
  class Utils(_Utils): pass
14
14
  class InboundAdapter(_InboundAdapter): pass
grongier/pex/__main__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # main entry is _cli.main()
2
2
  if __name__ == '__main__':
3
- import grongier.pex._cli as _cli
3
+ import iop._cli as _cli
4
4
  _cli.main()