iris-pex-embedded-python 2.3.22b3__tar.gz → 2.3.23b2__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 iris-pex-embedded-python might be problematic. Click here for more details.

Files changed (121) hide show
  1. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/pyproject.toml +1 -1
  3. iris_pex_embedded_python-2.3.23b2/src/grongier/cls/Grongier/Service/WSGI.cls +310 -0
  4. iris_pex_embedded_python-2.3.23b2/src/grongier/pex/wsgi/handlers.py +104 -0
  5. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_DBList.py +6 -0
  6. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISEmbedded.py +2 -2
  7. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListWriter.py +5 -1
  8. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_DBAPI.py +37 -13
  9. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_ResultSetRow.py +4 -0
  10. iris_pex_embedded_python-2.3.23b2/src/iris/__init__.pyi +187 -0
  11. iris_pex_embedded_python-2.3.23b2/src/iris/iris_ipm.pyi +17 -0
  12. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/PKG-INFO +2 -2
  13. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +2 -0
  14. iris_pex_embedded_python-2.3.22b3/src/grongier/cls/Grongier/Service/WSGI.cls +0 -105
  15. iris_pex_embedded_python-2.3.22b3/src/grongier/pex/wsgi/handlers.py +0 -51
  16. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/LICENSE +0 -0
  17. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/README.md +0 -0
  18. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/setup.cfg +0 -0
  19. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/setup.py +0 -0
  20. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/__init__.py +0 -0
  21. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
  22. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
  23. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
  24. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
  25. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
  26. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
  27. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
  28. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
  29. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
  30. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
  31. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
  32. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
  33. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
  34. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
  35. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
  36. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
  37. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
  38. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
  39. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
  40. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/__init__.py +0 -0
  41. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/__main__.py +0 -0
  42. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_host.py +0 -0
  43. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_operation.py +0 -0
  44. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_process.py +0 -0
  45. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_service.py +0 -0
  46. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_cli.py +0 -0
  47. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_common.py +0 -0
  48. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_director.py +0 -0
  49. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_inbound_adapter.py +0 -0
  50. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_message.py +0 -0
  51. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_outbound_adapter.py +0 -0
  52. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_pickle_message.py +0 -0
  53. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_private_session_duplex.py +0 -0
  54. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_private_session_process.py +0 -0
  55. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_utils.py +0 -0
  56. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_BufferReader.py +0 -0
  57. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_BufferWriter.py +0 -0
  58. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ConnectionInformation.py +0 -0
  59. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ConnectionParameters.py +0 -0
  60. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_Constant.py +0 -0
  61. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_Device.py +0 -0
  62. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayContext.py +0 -0
  63. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayException.py +0 -0
  64. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayUtility.py +0 -0
  65. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRIS.py +0 -0
  66. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISConnection.py +0 -0
  67. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISGlobalNode.py +0 -0
  68. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISGlobalNodeView.py +0 -0
  69. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISIterator.py +0 -0
  70. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISList.py +0 -0
  71. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISNative.py +0 -0
  72. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISOREF.py +0 -0
  73. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISObject.py +0 -0
  74. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISReference.py +0 -0
  75. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_InStream.py +0 -0
  76. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_LegacyIterator.py +0 -0
  77. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListItem.py +0 -0
  78. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListReader.py +0 -0
  79. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_LogFileStream.py +0 -0
  80. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_MessageHeader.py +0 -0
  81. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_OutStream.py +0 -0
  82. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_PrintStream.py +0 -0
  83. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_PythonGateway.py +0 -0
  84. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_SharedMemorySocket.py +0 -0
  85. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/__init__.py +0 -0
  86. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/__main__.py +0 -0
  87. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Column.py +0 -0
  88. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Descriptor.py +0 -0
  89. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_IRISStream.py +0 -0
  90. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Message.py +0 -0
  91. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Parameter.py +0 -0
  92. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_ParameterCollection.py +0 -0
  93. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_SQLType.py +0 -0
  94. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/__init__.py +0 -0
  95. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_PreParser.py +0 -0
  96. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_Scanner.py +0 -0
  97. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_Token.py +0 -0
  98. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_TokenList.py +0 -0
  99. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/__init__.py +0 -0
  100. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessHost.py +0 -0
  101. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessOperation.py +0 -0
  102. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessProcess.py +0 -0
  103. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessService.py +0 -0
  104. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Common.py +0 -0
  105. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Director.py +0 -0
  106. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISBusinessOperation.py +0 -0
  107. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISBusinessService.py +0 -0
  108. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISInboundAdapter.py +0 -0
  109. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISOutboundAdapter.py +0 -0
  110. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_InboundAdapter.py +0 -0
  111. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Message.py +0 -0
  112. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_OutboundAdapter.py +0 -0
  113. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/__init__.py +0 -0
  114. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris/__init__.py +0 -0
  115. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris/iris_ipm.py +0 -0
  116. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  117. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  118. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  119. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
  120. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/irisnative/_IRISNative.py +0 -0
  121. {iris_pex_embedded_python-2.3.22b3 → iris_pex_embedded_python-2.3.23b2}/src/irisnative/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 2.3.22b3
3
+ Version: 2.3.23b2
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "iris_pex_embedded_python"
6
- version = "2.3.22b3"
6
+ version = "2.3.23b2"
7
7
  description = "Iris Interoperability based on Embedded Python"
8
8
  readme = "README.md"
9
9
  authors = [
@@ -0,0 +1,310 @@
1
+ Class Grongier.Service.WSGI Extends %CSP.REST [ ServerOnly = 1 ]
2
+ {
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
+ #; Record if device re-direction is already active
35
+ Set tRedirected=##class(%Library.Device).ReDirectIO()
36
+
37
+ #; Record the redirect routine
38
+ Set tRedirectRoutine=$System.Device.GetMnemonicRoutine()
39
+
40
+ if ..#DEVMODE {
41
+ #; Not so pretty but help to for reload the WSGI application
42
+ do outputError^%SYS.cspServer2("","","","")
43
+ }
44
+ else {
45
+ #; Now switch to using THIS routine for device redirection
46
+ Use $io::("^%SYS.cspServer2")
47
+
48
+ #; Switch device redirection on (may already be on but thats ok)
49
+ Do ##class(%Library.Device).ReDirectIO(1)
50
+ }
51
+
52
+ #; Ensure that the application is defined (security check)
53
+ If $$$GetSecurityApplicationsDispatchClass(%request.AppData)="" {
54
+
55
+ #; Report not authorized
56
+ Set tSC=..Http403()
57
+
58
+ #; Done
59
+ Quit
60
+ }
61
+
62
+ #; GgiEnvs are not defined in the CSP shell
63
+ Set tURL=$Get(%request.CgiEnvs("CSPLIB"))
64
+ If tURL="" Set tURL=%request.URL
65
+
66
+ #; Do an access check
67
+ Set tSC=..AccessCheck(.tAuthorized)
68
+ If $$$ISERR(tSC) Quit
69
+
70
+ If tAuthorized=0 {
71
+
72
+ #; Don't want the session token
73
+ Set %response.OutputSessionToken=0
74
+
75
+ #; Set the Http Status
76
+ Set %response.Status=..#HTTP403FORBIDDEN
77
+
78
+ #; Done
79
+ Quit
80
+ }
81
+
82
+ #; Extract the match url from the application name
83
+ Set tMatchUrl = "/"_$Extract(tURL,$Length(%request.Application)+1,*)
84
+
85
+ #; Dispatch the request
86
+ Set tSC=..DispatchRequest(tMatchUrl,%request.Method)
87
+
88
+ } Catch (e) {
89
+ Set tSC=e.AsStatus()
90
+ }
91
+
92
+ If $$$ISERR(tSC) {
93
+
94
+ #; Don't want the session token
95
+ Set %response.OutputSessionToken=0
96
+
97
+ Do ..Http500(##class(%Exception.StatusException).CreateFromStatus(tSC))
98
+ }
99
+
100
+ #; Ensure that at least something is written out as the body
101
+ #; This will trigger the device redirect capture and force headers to be written
102
+ #; (if not already done)
103
+ Write ""
104
+
105
+ #; Reset redirect device if necessary
106
+ If tRedirected {
107
+
108
+ #; Use the original redirected routine
109
+ Use $io::("^"_tRedirectRoutine)
110
+
111
+ #; Switch device redirection on
112
+ Do ##class(%Library.Device).ReDirectIO(1)
113
+ }
114
+
115
+ #; Any errors should have been caught and reported
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
+ }
@@ -0,0 +1,104 @@
1
+ import os, sys, importlib, urllib.parse
2
+ from io import BytesIO
3
+
4
+ __ospath = os.getcwd()
5
+
6
+ import iris
7
+
8
+ os.chdir(__ospath)
9
+
10
+ enc, esc = sys.getfilesystemencoding(), 'surrogateescape'
11
+
12
+ rest_service = iris.cls('%REST.Impl')
13
+
14
+ def get_from_module(app_path, app_module, app_name):
15
+
16
+ # Add the path to the application
17
+ if (app_path not in sys.path) :
18
+ sys.path.append(app_path)
19
+
20
+ # retrieve the application
21
+ return getattr(importlib.import_module(app_module), app_name)
22
+
23
+ # Changes the current working directory to the manager directory of the instance.
24
+ def goto_manager_dir():
25
+ iris.system.Process.CurrentDirectory(iris.system.Util.ManagerDirectory())
26
+
27
+ def unicode_to_wsgi(u):
28
+ # Convert an environment variable to a WSGI "bytes-as-unicode" string
29
+ return u.encode(enc, esc).decode('iso-8859-1')
30
+
31
+ def wsgi_to_bytes(s):
32
+ return s.encode('iso-8859-1')
33
+
34
+ def write(chunk):
35
+ rest_service._WriteResponse(chunk)
36
+
37
+ def start_response(status, response_headers, exc_info=None):
38
+ '''WSGI start_response callable'''
39
+ if exc_info:
40
+ try:
41
+ raise exc_info[1].with_traceback(exc_info[2])
42
+ finally:
43
+ exc_info = None
44
+
45
+ rest_service._SetStatusCode(status)
46
+ for tuple in response_headers:
47
+ rest_service._SetHeader(tuple[0], tuple[1])
48
+ return write
49
+
50
+
51
+ # Make request to application
52
+ def make_request(environ, stream, application, path):
53
+
54
+ # Change the working directory for logging purposes
55
+ goto_manager_dir()
56
+
57
+ error_log_file = open('WSGI.log', 'a+')
58
+
59
+ # We want the working directory to be the app's directory
60
+ if (not path.endswith(os.path.sep)):
61
+ path = path + os.path.sep
62
+
63
+ #iris.system.Process.CurrentDirectory(path)
64
+
65
+ # Set up the body of the request
66
+ if stream != '':
67
+ bytestream = stream
68
+ elif (environ['CONTENT_TYPE'] == 'application/x-www-form-urlencoded'):
69
+ bytestream = BytesIO()
70
+ part = urllib.parse.urlencode(environ['formdata'])
71
+ bytestream.write(part.encode('utf-8'))
72
+ bytestream.seek(0)
73
+ else:
74
+ bytestream = BytesIO(b'')
75
+
76
+ #for k,v in os.environ.items():
77
+ #environ[k] = unicode_to_wsgi(v)
78
+ environ['wsgi.input'] = bytestream
79
+ environ['wsgi.errors'] = error_log_file
80
+ environ['wsgi.version'] = (1, 0)
81
+ environ['wsgi.multithread'] = False
82
+ environ['wsgi.multiprocess'] = True
83
+ environ['wsgi.run_once'] = True
84
+
85
+
86
+ if environ.get('HTTPS', 'off') in ('on', '1'):
87
+ environ['wsgi.url_scheme'] = 'https'
88
+ else:
89
+ environ['wsgi.url_scheme'] = 'http'
90
+
91
+ # Calling WSGI application
92
+ response = application(environ, start_response)
93
+
94
+ error_log_file.close()
95
+
96
+ try:
97
+ for data in response:
98
+ if data:
99
+ # (REST.Impl).Write() needs a utf-8 string
100
+ write(data.decode('utf-8'))
101
+ write(b'')
102
+ finally:
103
+ if hasattr(response, 'close'):
104
+ response.close()
@@ -1,6 +1,7 @@
1
1
  import struct
2
2
  import decimal
3
3
  import functools
4
+ import uuid
4
5
  import math
5
6
  import intersystems_iris._IRISOREF
6
7
  import datetime
@@ -326,6 +327,10 @@ class _DBList(object):
326
327
  offset = cls.__stuff_multibyte(buffer, offset, data, is_oref, locale)
327
328
  return offset
328
329
 
330
+ @classmethod
331
+ def _stuff_uuid(cls, buffer, offset, data, locale, is_unicode, *args):
332
+ return cls._stuff_str(buffer, offset, str(data), locale=locale, is_unicode=is_unicode)
333
+
329
334
  @classmethod
330
335
  def _stuff_datetime(cls, buffer, offset, data, locale, is_unicode, *args):
331
336
  return cls._stuff_str(buffer, offset, data.strftime('%Y-%m-%d %H:%M:%S.%f'), locale=locale, is_unicode=is_unicode)
@@ -496,5 +501,6 @@ _DBList._set_switcher = {
496
501
  float: _DBList._stuff_double,
497
502
  decimal.Decimal: _DBList._stuff_decimal,
498
503
  str: _DBList._stuff_str,
504
+ uuid.UUID: _DBList._stuff_uuid,
499
505
  intersystems_iris._IRISOREF._IRISOREF: _DBList._stuff_str,
500
506
  }
@@ -51,7 +51,7 @@ class _IRISEmbedded:
51
51
  reset_vars(current_vars)
52
52
  self.iris = iris
53
53
  self._connection_info._delimited_ids = 1
54
- self.restore_autocommit = iris.system.SQL.SetAutoCommit(0 if autoCommit is None else 1 if autoCommit else 2)
54
+ self.autoCommit = autoCommit
55
55
 
56
56
  def __enter__(self):
57
57
  return self
@@ -60,7 +60,6 @@ class _IRISEmbedded:
60
60
  self.close()
61
61
 
62
62
  def close(self):
63
- self.iris.system.SQL.SetAutoCommit(self.restore_autocommit)
64
63
  self.iris = None
65
64
 
66
65
  def isClosed(self):
@@ -76,6 +75,7 @@ class _IRISEmbedded:
76
75
  self._pre_preparse_cache[sql] = CachedSQL(cursor)
77
76
 
78
77
  def setAutoCommit(self, autoCommit):
78
+ self.autoCommit = autoCommit
79
79
  return self.iris.system.SQL.SetAutoCommit(0 if autoCommit is None else 1 if autoCommit else 2)
80
80
 
81
81
  def commit(self):
@@ -51,6 +51,7 @@ class _ListWriter(object):
51
51
  param_switcher = {
52
52
  SQLType.LONGVARBINARY: self._set_stream,
53
53
  SQLType.LONGVARCHAR: self._set_stream,
54
+ SQLType.GUID: self._set_uuid,
54
55
  SQLType.DATE: None,
55
56
  SQLType.TIME: None,
56
57
  SQLType.TIMESTAMP: None,
@@ -90,7 +91,10 @@ class _ListWriter(object):
90
91
  def _set_stream(self, stream):
91
92
  self._set(stream)
92
93
  # raise NotImplementedError("Stream functionality not yet available with iris.dbapi")
93
-
94
+
95
+ def _set_uuid(self, val):
96
+ self._set(str(val))
97
+
94
98
  def _set_date_h(self, date):
95
99
  HOROLOG_ORDINAL = datetime.date(1840, 12, 31).toordinal()
96
100
  if isinstance(date, datetime.date):
@@ -2,6 +2,7 @@ import struct
2
2
  import copy
3
3
  import enum
4
4
  import copy
5
+ import uuid
5
6
  import decimal
6
7
  import intersystems_iris
7
8
  from collections import namedtuple
@@ -337,7 +338,7 @@ class _BaseCursor:
337
338
  raise ValueError("INOUT/OUT parameters not permitted")
338
339
 
339
340
  self._prepared_update_execute()
340
-
341
+
341
342
  return self._rowcount
342
343
 
343
344
  def _process_sqlcode(self, sqlcode, message=None):
@@ -367,8 +368,9 @@ class _BaseCursor:
367
368
  if not self._is_batch_update:
368
369
  raise TypeError("Unsupported argument type: " + str(type(item)))
369
370
  for ele in item:
370
- if (not intersystems_iris._DBList._DBList._set_switcher.get(type(ele), None) and not issubclass(
371
- type(ele), enum.Enum)):
371
+ if not intersystems_iris._DBList._DBList._set_switcher.get(type(ele), None) and not issubclass(
372
+ type(ele), enum.Enum
373
+ ):
372
374
  raise TypeError("Unsupported argument type: " + str(type(ele)))
373
375
  elif intersystems_iris._DBList._DBList._set_switcher.get(type(item), None) is None:
374
376
  item = str(item)
@@ -661,7 +663,7 @@ class _BaseCursor:
661
663
  def description(self):
662
664
  if self._statementType is StatementType.UPDATE:
663
665
  return None
664
-
666
+
665
667
  if self._columns is None:
666
668
  return None
667
669
 
@@ -757,7 +759,7 @@ class Cursor(_BaseCursor):
757
759
  return True
758
760
  else:
759
761
  return False
760
-
762
+
761
763
  def _reset_cached_info(self):
762
764
  if not self._connection._preparedCache or not hasattr(self._connection._preparedCache, "__iter__"):
763
765
  return
@@ -1178,7 +1180,7 @@ class Cursor(_BaseCursor):
1178
1180
  sets = self._parameter_sets or 1
1179
1181
  self.params = list(self.params).copy()
1180
1182
  param_types = [param.type for param in self._params._params_list]
1181
-
1183
+
1182
1184
  for i in range(sets):
1183
1185
  params = self._params.collect(i)
1184
1186
  for pi, param in enumerate(params):
@@ -1207,14 +1209,18 @@ class Cursor(_BaseCursor):
1207
1209
  if size == 0:
1208
1210
  break
1209
1211
  size = 4096 if size > 4096 else size
1210
- chunk = value[offset:offset + size]
1212
+ chunk = value[offset : offset + size]
1211
1213
  if not isinstance(chunk, bytes):
1212
1214
  chunk = bytes(chunk, "utf-8")
1213
1215
  offset += size
1214
1216
  full_size -= size
1215
1217
 
1216
1218
  # message header
1217
- code = _Message.STORE_BINARY_STREAM if param_type == SQLType.LONGVARBINARY else _Message.STORE_CHARACTER_STREAM
1219
+ code = (
1220
+ _Message.STORE_BINARY_STREAM
1221
+ if param_type == SQLType.LONGVARBINARY
1222
+ else _Message.STORE_CHARACTER_STREAM
1223
+ )
1218
1224
  self._out_message.wire._write_header(code)
1219
1225
  intersystems_iris._MessageHeader._MessageHeader._set_statement_id(
1220
1226
  self._out_message.wire.buffer, self._statement_id
@@ -2240,10 +2246,23 @@ class EmbdeddedCursor(_BaseCursor):
2240
2246
  self._sql = connection.iris.sql
2241
2247
  self._iris = connection.iris
2242
2248
  self._closed = False
2249
+ self._connection = connection
2250
+ self.restore_selectmode = self._iris.system.SQL.SetSelectMode(1)
2251
+ self.restore_autocommit = self._iris.system.SQL.SetAutoCommit(
2252
+ 0 if self._connection.autoCommit is None else 1 if self._connection.autoCommit else 2
2253
+ )
2243
2254
 
2244
- # $System.SQL.SetSelectMode(1 /* ODBC */)
2245
- # $System.SQL.Util.SetOption("SelectMode", 1 /* ODBC */)
2246
- connection.iris.system.SQL.SetSelectMode(1)
2255
+ def close(self):
2256
+ self._iris.system.SQL.SetSelectMode(self.restore_selectmode)
2257
+ self._iris.system.SQL.SetAutoCommit(self.restore_autocommit)
2258
+ super().close()
2259
+
2260
+ def __del__(self):
2261
+ try:
2262
+ self.close()
2263
+ except:
2264
+ pass
2265
+ return
2247
2266
 
2248
2267
  def _get_cached_info(self):
2249
2268
  return False
@@ -2386,14 +2405,18 @@ class EmbdeddedCursor(_BaseCursor):
2386
2405
  sets = self._parameter_sets or 1
2387
2406
  metadata = self._statement.Statement._Metadata.parameters
2388
2407
  param_types = [metadata.GetAt(i + 1).ODBCType for i in range(metadata.Size)]
2389
-
2408
+
2390
2409
  stream_chunk_size = 32000
2391
2410
 
2392
2411
  for i in range(sets):
2393
2412
  params = self._get_parameters(i)
2394
2413
  for ip, param in enumerate(params):
2395
2414
  if param_types[ip] in (SQLType.LONGVARBINARY, SQLType.LONGVARCHAR):
2396
- stream_class = '%Stream.GlobalBinary' if param_types[ip] == SQLType.LONGVARBINARY else '%Stream.GlobalCharacter'
2415
+ stream_class = (
2416
+ "%Stream.GlobalBinary"
2417
+ if param_types[ip] == SQLType.LONGVARBINARY
2418
+ else "%Stream.GlobalCharacter"
2419
+ )
2397
2420
  stream = self._iris.cls(stream_class)._New()
2398
2421
  while param:
2399
2422
  stream.Write(param[:stream_chunk_size])
@@ -2448,6 +2471,7 @@ class EmbdeddedCursor(_BaseCursor):
2448
2471
  row = namedtuple("Row", [col.name for col in self._columns], rename=True)
2449
2472
 
2450
2473
  _types = {
2474
+ SQLType.GUID: uuid.UUID,
2451
2475
  SQLType.BIGINT: int,
2452
2476
  SQLType.BINARY: bytes,
2453
2477
  SQLType.VARBINARY: bytes,
@@ -1,3 +1,4 @@
1
+ import uuid
1
2
  from datetime import datetime
2
3
  from collections import namedtuple
3
4
  from ._SQLType import SQLType
@@ -67,6 +68,7 @@ class _ResultSetRow:
67
68
 
68
69
  class DataRow:
69
70
  _types = {
71
+ SQLType.GUID: uuid.UUID,
70
72
  SQLType.BIGINT: int,
71
73
  SQLType.BINARY: bytes,
72
74
  SQLType.BIT: None,
@@ -157,6 +159,8 @@ class _ResultSetRow:
157
159
  ctype = _column.type
158
160
  value_type = self._types[ctype] if ctype in self._types else None
159
161
  try:
162
+ if ctype == SQLType.GUID:
163
+ item = uuid.UUID(item)
160
164
  if ctype == SQLType.TIMESTAMP_POSIX:
161
165
  item = from_timestamp_posix(item)
162
166