iris-pex-embedded-python 2.3.4__tar.gz → 2.3.5__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 (48) hide show
  1. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/setup.py +1 -1
  3. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_process.py +7 -1
  4. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_utils.py +12 -3
  5. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/BusinessProcess.cls +5 -0
  6. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/WSGI.cls +99 -0
  7. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/PKG-INFO +1 -1
  8. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +1 -0
  9. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/LICENSE +0 -0
  10. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/README.md +0 -0
  11. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/pyproject.toml +0 -0
  12. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/setup.cfg +0 -0
  13. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/__init__.py +0 -0
  14. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/__main__.py +0 -0
  15. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_host.py +0 -0
  16. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_operation.py +0 -0
  17. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_service.py +0 -0
  18. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_cli.py +0 -0
  19. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_common.py +0 -0
  20. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_director.py +0 -0
  21. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_inbound_adapter.py +0 -0
  22. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_message.py +0 -0
  23. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_outbound_adapter.py +0 -0
  24. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_pickle_message.py +0 -0
  25. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_private_session_duplex.py +0 -0
  26. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_private_session_process.py +0 -0
  27. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/BusinessOperation.cls +0 -0
  28. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/BusinessService.cls +0 -0
  29. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Common.cls +0 -0
  30. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Director.cls +0 -0
  31. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Duplex/Operation.cls +0 -0
  32. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Duplex/Process.cls +0 -0
  33. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Duplex/Service.cls +0 -0
  34. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/InboundAdapter.cls +0 -0
  35. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Message.cls +0 -0
  36. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/OutboundAdapter.cls +0 -0
  37. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PickleMessage.cls +0 -0
  38. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PrivateSession/Duplex.cls +0 -0
  39. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PrivateSession/Message/Ack.cls +0 -0
  40. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PrivateSession/Message/Poll.cls +0 -0
  41. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PrivateSession/Message/Start.cls +0 -0
  42. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/PrivateSession/Message/Stop.cls +0 -0
  43. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Test.cls +0 -0
  44. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/data/PEX/Utils.cls +0 -0
  45. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  46. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  47. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  48. {iris_pex_embedded_python-2.3.4 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 2.3.4
3
+ Version: 2.3.5
4
4
  Summary: iris_pex_embedded_python
5
5
  Home-page: https://github.com/grongierisc/interoperability-embedded-python
6
6
  Author: grongier
@@ -26,7 +26,7 @@ def main():
26
26
  description='iris_pex_embedded_python',
27
27
  long_description=long_description,
28
28
  long_description_content_type='text/markdown',
29
- version='2.3.4',
29
+ version='2.3.5',
30
30
  author='grongier',
31
31
  author_email='guillaume.rongier@intersystems.com',
32
32
  keywords='iris_pex_embedded_python',
@@ -10,7 +10,9 @@ class _BusinessProcess(_BusinessHost):
10
10
  DISPATCH = []
11
11
 
12
12
  PERSISTENT_PROPERTY_LIST=None
13
- """ A list of the variable names of persistent properties."""
13
+ """ A list of the variable names of persistent properties."""
14
+
15
+ Context=None
14
16
 
15
17
  def on_message(self, request):
16
18
  """ Called when the business operation receives a message from another production component.
@@ -95,6 +97,8 @@ class _BusinessProcess(_BusinessHost):
95
97
 
96
98
  def _save_persistent_properties(self, host_object):
97
99
  """ For internal use only. """
100
+ if self.Context:
101
+ host_object.Context = self.Context
98
102
  if self.PERSISTENT_PROPERTY_LIST == None:
99
103
  return
100
104
  for prop in self.PERSISTENT_PROPERTY_LIST:
@@ -109,6 +113,8 @@ class _BusinessProcess(_BusinessHost):
109
113
 
110
114
  def _restore_persistent_properties(self, host_object):
111
115
  """ For internal use only. """
116
+ if host_object.Context:
117
+ self.Context = host_object.Context
112
118
  if self.PERSISTENT_PROPERTY_LIST == None:
113
119
  return
114
120
  for prop in self.PERSISTENT_PROPERTY_LIST:
@@ -190,13 +190,22 @@ class _Utils():
190
190
  raise ValueError("The filename must be absolute")
191
191
  # add the path to the system path
192
192
  sys.path.append(path)
193
- from settings import CLASSES, PRODUCTIONS
193
+ import settings
194
194
  except ImportError:
195
195
  # return an error if the settings file is not found
196
196
  # and explain how to create it
197
197
  raise ImportError("settings.py file not found. Please create it in the same directory as the main.py file. See the documentation for more information.")
198
- _Utils.set_classes_settings(CLASSES)
199
- _Utils.set_productions_settings(PRODUCTIONS)
198
+ try:
199
+ # set the classes settings
200
+ _Utils.set_classes_settings(settings.CLASSES)
201
+ except AttributeError:
202
+ print("No classes to register")
203
+ try:
204
+ # set the productions settings
205
+ _Utils.set_productions_settings(settings.PRODUCTIONS)
206
+ except AttributeError:
207
+ print("No productions to register")
208
+
200
209
 
201
210
 
202
211
  @staticmethod
@@ -9,6 +9,8 @@ Parameter SETTINGS = "%classname:Python BusinessProcess,%module:Python BusinessP
9
9
 
10
10
  Property persistentProperties As array Of %String(MAXLEN = "");
11
11
 
12
+ Property Context As Ens.BP.Context;
13
+
12
14
  Method dispatchReply(response)
13
15
  {
14
16
  set tSC = ..Reply(response)
@@ -100,6 +102,9 @@ Storage Default
100
102
  <Value name="5">
101
103
  <Value>%class</Value>
102
104
  </Value>
105
+ <Value name="6">
106
+ <Value>Context</Value>
107
+ </Value>
103
108
  </Data>
104
109
  <Data name="persistentProperties">
105
110
  <Attribute>persistentProperties</Attribute>
@@ -0,0 +1,99 @@
1
+ Class Grongier.PEX.WSGI Extends (%RegisteredObject, %CSP.REST) [ ServerOnly = 1 ]
2
+ {
3
+
4
+ Parameter CLASSPATHS;
5
+
6
+ Parameter MODULENAME;
7
+
8
+ Parameter APPNAME;
9
+
10
+ /// Instance of class
11
+ Property app As %SYS.Python;
12
+
13
+ /// Helper method to write data to the output stream
14
+ ClassMethod write(data)
15
+ {
16
+ w data
17
+ }
18
+
19
+ /// Helper to build the environ
20
+ ClassMethod GetEnviron() As %SYS.Python
21
+ {
22
+ //set builtins
23
+ set builtins = ##class(%SYS.Python).Import("builtins")
24
+
25
+ //import dict to create environ
26
+ set dict = builtins.dict()
27
+
28
+ #dim %request As %CSP.Request
29
+
30
+ //set environ
31
+ do dict."__setitem__"("SERVER_NAME", $System.INetInfo.LocalHostName())
32
+ do dict."__setitem__"("SERVER_PORT", "")
33
+ do dict."__setitem__"("SERVER_PROTOCOL", "HTTP/1.1")
34
+ do dict."__setitem__"("SERVER_SOFTWARE", "IRIS")
35
+ do dict."__setitem__"("SCRIPT_NAME", ..#APPNAME)
36
+ do dict."__setitem__"("REQUEST_METHOD", %request.Method)
37
+ do dict."__setitem__"("CONTENT_TYPE", %request.ContentType)
38
+ do dict."__setitem__"("CHARSET", %request.CharSet)
39
+ Set app=$$getapp^%SYS.cspServer(%request.URL,.path,.match,.updatedurl)
40
+ do dict."__setitem__"("PATH_INFO", $extract(updatedurl,$length(path),*))
41
+
42
+ // to extract the query string
43
+
44
+ return dict
45
+ }
46
+
47
+ ClassMethod Page(skipheader As %Boolean = 1) As %Status [ Internal, ServerOnly = 1 ]
48
+ {
49
+ Try {
50
+ //set classpass
51
+ if ..#CLASSPATHS '="" {
52
+ set sys = ##class(%SYS.Python).Import("sys")
53
+ set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
54
+ set extraClasspaths = $tr(..#CLASSPATHS,delimiter,"|")
55
+ for i=1:1:$l(extraClasspaths,"|") {
56
+ set onePath = $p(extraClasspaths,"|",i)
57
+ set onePath = ##class(%File).NormalizeDirectory(onePath)
58
+ if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
59
+ if onePath'="" do sys.path.append(onePath)
60
+ }
61
+ }
62
+
63
+ //set environ
64
+ set environ = ..GetEnviron()
65
+
66
+ //import sys
67
+ set sys = ##class(%SYS.Python).Import("sys")
68
+
69
+ //set stdin
70
+ set builtins = ##class(%SYS.Python).Import("builtins")
71
+ set ba = builtins.bytearray()
72
+
73
+ while %request.Content.AtEnd = 0 {
74
+ do ba.extend(##class(%SYS.Python).Bytes(%request.Content.Read()))
75
+ }
76
+ //set handler
77
+ set handler = ##class(%SYS.Python).Import("grongier.pex.wsgi.handlers").IrisHandler(ba, sys.stdout, sys.stderr,environ)
78
+
79
+ //set module
80
+ set module = ##class(%SYS.Python).Import(..#MODULENAME)
81
+
82
+ //set builtins
83
+ set builtins = ##class(%SYS.Python).Import("builtins")
84
+
85
+ //set app
86
+ set application = builtins.getattr(module, ..#APPNAME)
87
+
88
+ //run app
89
+ do handler.run(application)
90
+
91
+ }
92
+ Catch ex {
93
+ return ex.AsStatus()
94
+ }
95
+
96
+ quit $$$OK
97
+ }
98
+
99
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris-pex-embedded-python
3
- Version: 2.3.4
3
+ Version: 2.3.5
4
4
  Summary: iris_pex_embedded_python
5
5
  Home-page: https://github.com/grongierisc/interoperability-embedded-python
6
6
  Author: grongier
@@ -29,6 +29,7 @@ src/grongier/pex/data/PEX/OutboundAdapter.cls
29
29
  src/grongier/pex/data/PEX/PickleMessage.cls
30
30
  src/grongier/pex/data/PEX/Test.cls
31
31
  src/grongier/pex/data/PEX/Utils.cls
32
+ src/grongier/pex/data/PEX/WSGI.cls
32
33
  src/grongier/pex/data/PEX/Duplex/Operation.cls
33
34
  src/grongier/pex/data/PEX/Duplex/Process.cls
34
35
  src/grongier/pex/data/PEX/Duplex/Service.cls