iris-pex-embedded-python 2.3.23b1__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.23b1 → iris_pex_embedded_python-2.3.23b2}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-2.3.23b1 → 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.23b1 → iris_pex_embedded_python-2.3.23b2}/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.23b2}/LICENSE +0 -0
  9. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/README.md +0 -0
  10. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/setup.cfg +0 -0
  11. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/setup.py +0 -0
  12. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/__init__.py +0 -0
  13. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
  14. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
  15. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
  16. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
  17. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
  18. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
  19. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
  20. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
  21. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
  22. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
  23. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
  24. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
  25. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
  26. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/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.23b2}/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.23b2}/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.23b2}/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.23b2}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
  31. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
  32. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/__init__.py +0 -0
  33. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/__main__.py +0 -0
  34. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_host.py +0 -0
  35. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_operation.py +0 -0
  36. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_process.py +0 -0
  37. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_business_service.py +0 -0
  38. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_cli.py +0 -0
  39. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_common.py +0 -0
  40. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_director.py +0 -0
  41. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_inbound_adapter.py +0 -0
  42. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_message.py +0 -0
  43. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_outbound_adapter.py +0 -0
  44. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_pickle_message.py +0 -0
  45. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_private_session_duplex.py +0 -0
  46. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_private_session_process.py +0 -0
  47. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/grongier/pex/_utils.py +0 -0
  48. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_BufferReader.py +0 -0
  49. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_BufferWriter.py +0 -0
  50. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ConnectionInformation.py +0 -0
  51. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ConnectionParameters.py +0 -0
  52. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_Constant.py +0 -0
  53. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_DBList.py +0 -0
  54. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_Device.py +0 -0
  55. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayContext.py +0 -0
  56. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayException.py +0 -0
  57. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_GatewayUtility.py +0 -0
  58. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRIS.py +0 -0
  59. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISConnection.py +0 -0
  60. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISEmbedded.py +0 -0
  61. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISGlobalNode.py +0 -0
  62. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISGlobalNodeView.py +0 -0
  63. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISIterator.py +0 -0
  64. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISList.py +0 -0
  65. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISNative.py +0 -0
  66. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISOREF.py +0 -0
  67. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISObject.py +0 -0
  68. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_IRISReference.py +0 -0
  69. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_InStream.py +0 -0
  70. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_LegacyIterator.py +0 -0
  71. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListItem.py +0 -0
  72. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListReader.py +0 -0
  73. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_ListWriter.py +0 -0
  74. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_LogFileStream.py +0 -0
  75. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_MessageHeader.py +0 -0
  76. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_OutStream.py +0 -0
  77. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_PrintStream.py +0 -0
  78. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_PythonGateway.py +0 -0
  79. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/_SharedMemorySocket.py +0 -0
  80. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/__init__.py +0 -0
  81. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/__main__.py +0 -0
  82. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Column.py +0 -0
  83. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_DBAPI.py +0 -0
  84. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Descriptor.py +0 -0
  85. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_IRISStream.py +0 -0
  86. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Message.py +0 -0
  87. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_Parameter.py +0 -0
  88. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_ParameterCollection.py +0 -0
  89. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_ResultSetRow.py +0 -0
  90. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/_SQLType.py +0 -0
  91. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/__init__.py +0 -0
  92. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_PreParser.py +0 -0
  93. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_Scanner.py +0 -0
  94. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_Token.py +0 -0
  95. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/_TokenList.py +0 -0
  96. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/dbapi/preparser/__init__.py +0 -0
  97. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessHost.py +0 -0
  98. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessOperation.py +0 -0
  99. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessProcess.py +0 -0
  100. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_BusinessService.py +0 -0
  101. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Common.py +0 -0
  102. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Director.py +0 -0
  103. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISBusinessOperation.py +0 -0
  104. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISBusinessService.py +0 -0
  105. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISInboundAdapter.py +0 -0
  106. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_IRISOutboundAdapter.py +0 -0
  107. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_InboundAdapter.py +0 -0
  108. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_Message.py +0 -0
  109. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/_OutboundAdapter.py +0 -0
  110. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/intersystems_iris/pex/__init__.py +0 -0
  111. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/iris/__init__.py +0 -0
  112. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/iris/__init__.pyi +0 -0
  113. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/iris/iris_ipm.py +0 -0
  114. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/src/iris/iris_ipm.pyi +0 -0
  115. {iris_pex_embedded_python-2.3.23b1 → iris_pex_embedded_python-2.3.23b2}/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.23b2}/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.23b2}/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.23b2}/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.23b2}/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.23b2}/src/irisnative/_IRISNative.py +0 -0
  121. {iris_pex_embedded_python-2.3.23b1 → 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.23b1
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.23b1"
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,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 2.3.23b1
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
@@ -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