iris-pex-embedded-python 2.3.23b1__tar.gz → 2.3.23b3__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.23b1 → iris_pex_embedded_python-2.3.23b3}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/pyproject.toml +1 -1
  3. iris_pex_embedded_python-2.3.23b3/src/grongier/cls/Grongier/Service/WSGI.cls +307 -0
  4. iris_pex_embedded_python-2.3.23b3/src/grongier/pex/wsgi/handlers.py +104 -0
  5. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/PKG-INFO +1 -1
  6. iris_pex_embedded_python-2.3.23b1/src/grongier/cls/Grongier/Service/WSGI.cls +0 -105
  7. iris_pex_embedded_python-2.3.23b1/src/grongier/pex/wsgi/handlers.py +0 -51
  8. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/LICENSE +0 -0
  9. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/README.md +0 -0
  10. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/setup.cfg +0 -0
  11. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/setup.py +0 -0
  12. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/__init__.py +0 -0
  13. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
  14. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
  15. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
  16. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
  17. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
  18. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
  19. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
  20. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
  21. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
  22. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
  23. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
  24. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
  25. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
  26. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
  27. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
  28. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
  29. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
  30. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
  31. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
  32. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/__init__.py +0 -0
  33. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/__main__.py +0 -0
  34. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_business_host.py +0 -0
  35. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_business_operation.py +0 -0
  36. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_business_process.py +0 -0
  37. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_business_service.py +0 -0
  38. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_cli.py +0 -0
  39. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_common.py +0 -0
  40. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_director.py +0 -0
  41. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_inbound_adapter.py +0 -0
  42. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_message.py +0 -0
  43. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_outbound_adapter.py +0 -0
  44. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_pickle_message.py +0 -0
  45. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_private_session_duplex.py +0 -0
  46. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_private_session_process.py +0 -0
  47. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/grongier/pex/_utils.py +0 -0
  48. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_BufferReader.py +0 -0
  49. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_BufferWriter.py +0 -0
  50. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_ConnectionInformation.py +0 -0
  51. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_ConnectionParameters.py +0 -0
  52. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_Constant.py +0 -0
  53. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_DBList.py +0 -0
  54. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_Device.py +0 -0
  55. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_GatewayContext.py +0 -0
  56. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_GatewayException.py +0 -0
  57. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_GatewayUtility.py +0 -0
  58. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRIS.py +0 -0
  59. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISConnection.py +0 -0
  60. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISEmbedded.py +0 -0
  61. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISGlobalNode.py +0 -0
  62. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISGlobalNodeView.py +0 -0
  63. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISIterator.py +0 -0
  64. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISList.py +0 -0
  65. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISNative.py +0 -0
  66. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISOREF.py +0 -0
  67. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISObject.py +0 -0
  68. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_IRISReference.py +0 -0
  69. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_InStream.py +0 -0
  70. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_LegacyIterator.py +0 -0
  71. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_ListItem.py +0 -0
  72. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_ListReader.py +0 -0
  73. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_ListWriter.py +0 -0
  74. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_LogFileStream.py +0 -0
  75. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_MessageHeader.py +0 -0
  76. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_OutStream.py +0 -0
  77. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_PrintStream.py +0 -0
  78. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_PythonGateway.py +0 -0
  79. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/_SharedMemorySocket.py +0 -0
  80. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/__init__.py +0 -0
  81. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/__main__.py +0 -0
  82. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_Column.py +0 -0
  83. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_DBAPI.py +0 -0
  84. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_Descriptor.py +0 -0
  85. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_IRISStream.py +0 -0
  86. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_Message.py +0 -0
  87. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_Parameter.py +0 -0
  88. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_ParameterCollection.py +0 -0
  89. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_ResultSetRow.py +0 -0
  90. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/_SQLType.py +0 -0
  91. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/__init__.py +0 -0
  92. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/preparser/_PreParser.py +0 -0
  93. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/preparser/_Scanner.py +0 -0
  94. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/preparser/_Token.py +0 -0
  95. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/preparser/_TokenList.py +0 -0
  96. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/dbapi/preparser/__init__.py +0 -0
  97. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_BusinessHost.py +0 -0
  98. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_BusinessOperation.py +0 -0
  99. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_BusinessProcess.py +0 -0
  100. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_BusinessService.py +0 -0
  101. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_Common.py +0 -0
  102. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_Director.py +0 -0
  103. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_IRISBusinessOperation.py +0 -0
  104. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_IRISBusinessService.py +0 -0
  105. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_IRISInboundAdapter.py +0 -0
  106. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_IRISOutboundAdapter.py +0 -0
  107. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_InboundAdapter.py +0 -0
  108. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_Message.py +0 -0
  109. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/_OutboundAdapter.py +0 -0
  110. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/intersystems_iris/pex/__init__.py +0 -0
  111. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris/__init__.py +0 -0
  112. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris/__init__.pyi +0 -0
  113. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris/iris_ipm.py +0 -0
  114. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris/iris_ipm.pyi +0 -0
  115. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +0 -0
  116. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  117. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  118. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  119. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
  120. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/src/irisnative/_IRISNative.py +0 -0
  121. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b3}/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.23b1
3
+ Version: 2.3.23b3
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.23b1"
6
+ version = "2.3.23b3"
7
7
  description = "Iris Interoperability based on Embedded Python"
8
8
  readme = "README.md"
9
9
  authors = [
@@ -0,0 +1,307 @@
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
+ if ..#DEVMODE {
35
+ w %session.SessionId
36
+ }
37
+
38
+ #; Record if device re-direction is already active
39
+ Set tRedirected=##class(%Library.Device).ReDirectIO()
40
+
41
+ #; Record the redirect routine
42
+ Set tRedirectRoutine=$System.Device.GetMnemonicRoutine()
43
+
44
+ #; Now switch to using THIS routine for device redirection
45
+ Use $io::("^%SYS.cspServer2")
46
+
47
+ #; Switch device redirection on (may already be on but thats ok)
48
+ Do ##class(%Library.Device).ReDirectIO(1)
49
+
50
+ #; Ensure that the application is defined (security check)
51
+ If $$$GetSecurityApplicationsDispatchClass(%request.AppData)="" {
52
+
53
+ #; Report not authorized
54
+ Set tSC=..Http403()
55
+
56
+ #; Done
57
+ Quit
58
+ }
59
+
60
+ #; GgiEnvs are not defined in the CSP shell
61
+ Set tURL=$Get(%request.CgiEnvs("CSPLIB"))
62
+ If tURL="" Set tURL=%request.URL
63
+
64
+ #; Do an access check
65
+ Set tSC=..AccessCheck(.tAuthorized)
66
+ If $$$ISERR(tSC) Quit
67
+
68
+ If tAuthorized=0 {
69
+
70
+ #; Don't want the session token
71
+ Set %response.OutputSessionToken=0
72
+
73
+ #; Set the Http Status
74
+ Set %response.Status=..#HTTP403FORBIDDEN
75
+
76
+ #; Done
77
+ Quit
78
+ }
79
+
80
+ #; Extract the match url from the application name
81
+ Set tMatchUrl = "/"_$Extract(tURL,$Length(%request.Application)+1,*)
82
+
83
+ #; Dispatch the request
84
+ Set tSC=..DispatchRequest(tMatchUrl,%request.Method)
85
+
86
+ } Catch (e) {
87
+ Set tSC=e.AsStatus()
88
+ }
89
+
90
+ If $$$ISERR(tSC) {
91
+
92
+ #; Don't want the session token
93
+ Set %response.OutputSessionToken=0
94
+
95
+ Do ..Http500(##class(%Exception.StatusException).CreateFromStatus(tSC))
96
+ }
97
+
98
+ #; Ensure that at least something is written out as the body
99
+ #; This will trigger the device redirect capture and force headers to be written
100
+ #; (if not already done)
101
+ Write ""
102
+
103
+ #; Reset redirect device if necessary
104
+ If tRedirected {
105
+
106
+ #; Use the original redirected routine
107
+ Use $io::("^"_tRedirectRoutine)
108
+
109
+ #; Switch device redirection on
110
+ Do ##class(%Library.Device).ReDirectIO(1)
111
+ }
112
+
113
+ Quit $$$OK
114
+ }
115
+
116
+ ClassMethod OnPreDispatch(
117
+ pUrl As %String,
118
+ pMethod As %String,
119
+ ByRef pContinue As %Boolean) As %Status
120
+ {
121
+ Set path = ..#CLASSPATHS
122
+ Set appName = ..#APPNAME
123
+ Set module = ..#MODULENAME
124
+ Set devmode = ..#DEVMODE
125
+ Set pContinue = 1
126
+ Do ..DispatchREST(pUrl, path, appName, module, devmode)
127
+ Quit $$$OK
128
+ }
129
+
130
+ ClassMethod DispatchREST(
131
+ PathInfo As %String,
132
+ appPath As %String,
133
+ appName As %String,
134
+ module As %String,
135
+ devmode As %Boolean = 1) As %Status
136
+ {
137
+ Set builtins = ##CLASS(%SYS.Python).Builtins()
138
+ Set interface = ##CLASS(%SYS.Python).Import("grongier.pex.wsgi.handlers")
139
+ Set rawformdata = ""
140
+ Set environ = builtins.dict()
141
+ Set key = %request.NextCgiEnv("")
142
+
143
+ // Let's check if the WSGI application has been loaded or not for this session.
144
+
145
+ If (($DATA(%session.Data("application")) && $ISOBJECT(%session.Data("application"))) && 'devmode) {
146
+ Set application = %session.Data("Application")
147
+ }
148
+ Else{
149
+
150
+ Set application = ..GetPythonClass(appName, module, appPath)
151
+ If application = "" {
152
+ throw ##class(%Exception.General).%New("Error loading WSGI application: "_module_"."_appName_" from "_appPath)
153
+ }
154
+ Else {
155
+ Set %session.Data("Application") = application
156
+ }
157
+ }
158
+
159
+ // Editing some CGI variables that may be incorrect in %request
160
+ // Also filling in environ with as many CGI variables as possible from %request
161
+ // WSGI states that all CGI variables are valid and should be included if possible
162
+ While (key'="") {
163
+ Set value = %request.GetCgiEnv(key)
164
+ If key = "PATH_INFO" {
165
+ Set app=$$getapp^%SYS.cspServer(%request.URL,.path,.match,.updatedurl)
166
+ Set value = $EXTRACT(updatedurl,$LENGTH(path),*)
167
+ }
168
+ If key = "SCRIPT_NAME" {
169
+ //%request will sometimes have Script_name include Path_info
170
+ Set value = $PIECE(%request.Application, "/",1,*-1)
171
+ }
172
+ Do environ."__setitem__"(key,value)
173
+ Set key = %request.NextCgiEnv(key)
174
+ }
175
+
176
+ //Have to set up a correct wsgi.input stream from %request
177
+ Set stream = %request.Content
178
+
179
+ Set contentType = %request.ContentType
180
+ Set contentLength = 0
181
+
182
+ If contentType = "application/x-www-form-urlencoded" {
183
+ Set formdict = builtins.dict()
184
+ Set key = $ORDER(%request.Data(""))
185
+ While (key'="") {
186
+ Set value = $GET(%request.Data(key,1))
187
+ Do formdict."__setitem__"(key,value)
188
+ Set key = $ORDER(%request.Data(key))
189
+ }
190
+ Do environ."__setitem__"("formdata", formdict)
191
+ }
192
+ ElseIf contentType = "multipart/form-data" {
193
+ Set boundary = $PIECE(%request.GetCgiEnv("CONTENT_TYPE"), "=",2)
194
+ Set stream = ##CLASS(%CSP.BinaryStream).%New()
195
+
196
+ Do stream.Write($CHAR(13,10))
197
+
198
+ //Get the Form Data values
199
+
200
+ Set key = $ORDER(%request.Data(""))
201
+ While (key'="") {
202
+ Do stream.Write("--")
203
+ Do stream.Write(boundary)
204
+ Do stream.Write($CHAR(13,10))
205
+ Set value = $GET(%request.Data(key,1))
206
+ Do stream.Write("Content-Disposition: form-data; name=")
207
+ Do stream.Write(""""_key_"""")
208
+ Do stream.Write($CHAR(13,10,13,10))
209
+ Do stream.Write(value)
210
+ Do stream.Write($CHAR(13,10))
211
+ Set key = $ORDER(%request.Data(key))
212
+ }
213
+
214
+ //Now get the possible MIME data streams
215
+ Set key = %request.NextMimeData("")
216
+ While key'="" {
217
+ Set numMimeStreams = %request.CountMimeData(key)
218
+ Set index = %request.NextMimeDataIndex(key, "")
219
+ Do stream.Write("--")
220
+ Do stream.Write(boundary)
221
+ Do stream.Write($CHAR(13,10))
222
+ If numMimeStreams > 1 {
223
+ //I need to create a boundary for a nested multipart content type
224
+ Set internalboundary = "--"
225
+ For i = 1 : 1 : 7 {
226
+ Set internalboundary = internalboundary _ $RANDOM(10)
227
+ }
228
+ While index '= "" {
229
+ Set mimestream = %request.GetMimeData(key, index)
230
+ Set headers = mimestream.Headers
231
+ Do stream.Write("--")
232
+ Do stream.Write(internalboundary)
233
+ Do stream.Write($CHAR(13,10))
234
+ Do stream.Write(headers)
235
+ Do stream.Write($CHAR(13,10,13,10))
236
+ Set sc = stream.CopyFrom(mimestream)
237
+ //TODO error handling
238
+ Do stream.Write($CHAR(13,10))
239
+ Set index = %request.NextMimeDataIndex(key, index)
240
+ }
241
+ Do stream.Write("--")
242
+ Do stream.Write(internalboundary)
243
+ Do stream.Write("--")
244
+ }
245
+ Else {
246
+ Set mimestream = %request.GetMimeData(key, index)
247
+ Set headers = mimestream.Headers
248
+ Do stream.Write(headers)
249
+ Do stream.Write($CHAR(13,10,13,10))
250
+ Set sc = stream.CopyFrom(mimestream)
251
+ //TODO error handling
252
+ Do stream.Write($CHAR(13,10))
253
+ }
254
+ Set key = %request.NextMimeData(key)
255
+ }
256
+ Do stream.Write("--")
257
+ Do stream.Write(boundary)
258
+ Do stream.Write("--")
259
+ Do stream.Rewind()
260
+ }
261
+
262
+
263
+ Try {
264
+ Do interface."make_request"(environ, stream, application, appPath)
265
+ }
266
+ Catch exception {
267
+ throw exception
268
+ }
269
+ Quit $$$OK
270
+ }
271
+
272
+ ClassMethod GetPythonClass(
273
+ pClassname As %String,
274
+ pModule As %String,
275
+ pClasspath As %String) As %SYS.Python
276
+ {
277
+ Try {
278
+ If pClasspath '="" {
279
+ set sys = ##class(%SYS.Python).Import("sys")
280
+
281
+ for i=0:1:(sys.path."__len__"()-1) {
282
+ Try {
283
+ if sys.path."__getitem__"(i) = pClasspath {
284
+ do sys.path."__delitem__"(i)
285
+ }
286
+ }
287
+ Catch ex {
288
+ // do nothing
289
+ }
290
+
291
+ }
292
+ do sys.path.insert(0, pClasspath)
293
+ }
294
+
295
+ Set importlib = ##class(%SYS.Python).Import("importlib")
296
+ Set builtins = ##class(%SYS.Python).Import("builtins")
297
+ Set module = importlib."import_module"(pModule)
298
+ Set class = builtins.getattr(module, pClassname)
299
+ }
300
+ Catch ex {
301
+ throw ##class(%Exception.General).%New("Error loading WSGI application: "_pModule_"."_pClassname_" from "_pClasspath)
302
+ }
303
+
304
+ Quit class
305
+ }
306
+
307
+ }
@@ -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,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 2.3.23b1
3
+ Version: 2.3.23b3
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -1,105 +0,0 @@
1
- Class Grongier.Service.WSGI Extends (%RegisteredObject, %CSP.REST) [ ServerOnly = 1 ]
2
- {
3
-
4
- Parameter CLASSPATHS;
5
-
6
- Parameter MODULENAME;
7
-
8
- Parameter APPNAME;
9
-
10
- /// Helper method to write data to the output stream
11
- ClassMethod write(data)
12
- {
13
- w data
14
- }
15
-
16
- /// Helper to build the environ
17
- ClassMethod GetEnviron() As %SYS.Python
18
- {
19
- //set builtins
20
- set builtins = ##class(%SYS.Python).Import("builtins")
21
-
22
- //import dict to create environ
23
- set dict = builtins.dict()
24
-
25
- #dim %request As %CSP.Request
26
-
27
- //set environ
28
- do dict."__setitem__"("SERVER_NAME", $System.INetInfo.LocalHostName())
29
- do dict."__setitem__"("SERVER_PORT", "")
30
- do dict."__setitem__"("SERVER_PROTOCOL", "HTTP/1.1")
31
- do dict."__setitem__"("SERVER_SOFTWARE", "IRIS")
32
- do dict."__setitem__"("SCRIPT_NAME", ..#APPNAME)
33
- do dict."__setitem__"("REQUEST_METHOD", %request.Method)
34
- do dict."__setitem__"("CONTENT_TYPE", %request.ContentType)
35
- do dict."__setitem__"("CHARSET", %request.CharSet)
36
- Set app=$$getapp^%SYS.cspServer(%request.URL,.path,.match,.updatedurl)
37
- do dict."__setitem__"("PATH_INFO", $extract(updatedurl,$length(path),*))
38
-
39
- // to extract the query string
40
-
41
- return dict
42
- }
43
-
44
- /// Implement a singleton pattern to get the python app
45
- ClassMethod GetPyhonApp() As %SYS.Python
46
- {
47
- if ..#CLASSPATHS '="" {
48
- set sys = ##class(%SYS.Python).Import("sys")
49
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
50
- set extraClasspaths = $tr(..#CLASSPATHS,delimiter,"|")
51
- for i=1:1:$l(extraClasspaths,"|") {
52
- set onePath = $p(extraClasspaths,"|",i)
53
- set onePath = ##class(%File).NormalizeDirectory(onePath)
54
- if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
55
- if onePath'="" do sys.path.append(onePath)
56
- }
57
- }
58
-
59
- //import module
60
- set module = ##class(%SYS.Python).Import(..#MODULENAME)
61
-
62
- //set builtins
63
- set builtins = ##class(%SYS.Python).Import("builtins")
64
-
65
- //set app
66
- set application = builtins.getattr(module, ..#APPNAME)
67
-
68
- Return application
69
- }
70
-
71
- ClassMethod Page(skipheader As %Boolean = 1) As %Status [ Internal, ServerOnly = 1 ]
72
- {
73
- Try {
74
-
75
- //set environ
76
- set environ = ..GetEnviron()
77
-
78
- //import sys
79
- set sys = ##class(%SYS.Python).Import("sys")
80
-
81
- //set stdin
82
- set builtins = ##class(%SYS.Python).Import("builtins")
83
- set ba = builtins.bytearray()
84
-
85
- while %request.Content.AtEnd = 0 {
86
- do ba.extend(##class(%SYS.Python).Bytes(%request.Content.Read()))
87
- }
88
- //set handler
89
- set handler = ##class(%SYS.Python).Import("grongier.pex.wsgi.handlers").IrisHandler(ba, sys.stdout, sys.stderr,environ)
90
-
91
- // get a singleton app
92
- set application = ..GetPyhonApp()
93
-
94
- //run app
95
- do handler.run(application)
96
-
97
- }
98
- Catch ex {
99
- return ex.AsStatus()
100
- }
101
-
102
- quit $$$OK
103
- }
104
-
105
- }
@@ -1,51 +0,0 @@
1
- from wsgiref.handlers import BaseHandler
2
- import io
3
- import iris
4
-
5
- class IrisHandler(BaseHandler):
6
- """Handler that's just initialized with streams, environment, etc.
7
-
8
- This handler subclass is intended for synchronous HTTP/1.0 origin servers,
9
- and handles sending the entire response output, given the correct inputs.
10
-
11
- Usage::
12
-
13
- handler = SimpleHandler(
14
- inp,out,err,env, multithread=False, multiprocess=True
15
- )
16
- handler.run(app)"""
17
-
18
- server_software = "IrisWSGI/0.1"
19
- wsgi_file_wrapper = None
20
-
21
- def __init__(self,stdin,stdout,stderr,environ,
22
- multithread=True, multiprocess=False
23
- ):
24
- self.stdin = stdin
25
- self.stdout = stdout
26
- self.stderr = stderr
27
- self.base_env = environ
28
- self.wsgi_multithread = multithread
29
- self.wsgi_multiprocess = multiprocess
30
-
31
- def get_stdin(self):
32
- if not self.stdin:
33
- return None
34
- else:
35
- self.environ["wsgi.input"] = io.BytesIO(self.stdin)
36
- self.environ["CONTENT_LENGTH"] = str(len(self.stdin))
37
- return io.BytesIO(self.stdin)
38
-
39
-
40
- def get_stderr(self):
41
- return self.stderr
42
-
43
- def add_cgi_vars(self):
44
- self.environ.update(self.base_env)
45
-
46
- def _write(self,data):
47
- iris.cls('Grongier.Service.WSGI').write(data)
48
-
49
- def _flush(self):
50
- self.stdout.flush()
51
- self._flush = self.stdout.flush