iris-pex-embedded-python 3.5.2b1__tar.gz → 3.5.2b2__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 (98) hide show
  1. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/pyproject.toml +1 -1
  3. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_utils.py +9 -9
  4. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Projection.cls +1 -0
  5. iris_pex_embedded_python-3.5.2b2/src/iop/cls/IOP/Service/Remote/Rest/v1.cls +97 -0
  6. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/PKG-INFO +1 -1
  7. iris_pex_embedded_python-3.5.2b1/src/iop/cls/IOP/Service/Remote/Rest/v1.cls +0 -90
  8. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/LICENSE +0 -0
  9. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/README.md +0 -0
  10. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/setup.cfg +0 -0
  11. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/setup.py +0 -0
  12. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/__init__.py +0 -0
  13. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
  14. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
  15. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
  16. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
  17. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
  18. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
  19. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
  20. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
  21. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
  22. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
  23. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
  24. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
  25. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
  26. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
  27. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
  28. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
  29. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
  30. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
  31. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
  32. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/cls/Grongier/Service/WSGI.cls +0 -0
  33. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/__init__.py +0 -0
  34. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/__main__.py +0 -0
  35. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/_business_host.py +0 -0
  36. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/_cli.py +0 -0
  37. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/_common.py +0 -0
  38. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/_director.py +0 -0
  39. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/_utils.py +0 -0
  40. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/grongier/pex/wsgi/handlers.py +0 -0
  41. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/__init__.py +0 -0
  42. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/__main__.py +0 -0
  43. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_async_request.py +0 -0
  44. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_business_host.py +0 -0
  45. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_business_operation.py +0 -0
  46. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_business_process.py +0 -0
  47. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_business_service.py +0 -0
  48. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_cli.py +0 -0
  49. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_common.py +0 -0
  50. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_debugpy.py +0 -0
  51. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_decorators.py +0 -0
  52. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_director.py +0 -0
  53. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_dispatch.py +0 -0
  54. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_generator_request.py +0 -0
  55. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_inbound_adapter.py +0 -0
  56. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_iris.py +0 -0
  57. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_log_manager.py +0 -0
  58. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_message.py +0 -0
  59. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_message_validator.py +0 -0
  60. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_outbound_adapter.py +0 -0
  61. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_private_session_duplex.py +0 -0
  62. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_private_session_process.py +0 -0
  63. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_remote.py +0 -0
  64. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/_serialization.py +0 -0
  65. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/BusinessOperation.cls +0 -0
  66. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/BusinessProcess.cls +0 -0
  67. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/BusinessService.cls +0 -0
  68. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Common.cls +0 -0
  69. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Director.cls +0 -0
  70. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Duplex/Operation.cls +0 -0
  71. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Duplex/Process.cls +0 -0
  72. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Duplex/Service.cls +0 -0
  73. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Generator/Message/Ack.cls +0 -0
  74. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Generator/Message/Poll.cls +0 -0
  75. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Generator/Message/Start.cls +0 -0
  76. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Generator/Message/StartPickle.cls +0 -0
  77. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Generator/Message/Stop.cls +0 -0
  78. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/InboundAdapter.cls +0 -0
  79. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Message/JSONSchema.cls +0 -0
  80. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Message.cls +0 -0
  81. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/OutboundAdapter.cls +0 -0
  82. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PickleMessage.cls +0 -0
  83. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PrivateSession/Duplex.cls +0 -0
  84. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PrivateSession/Message/Ack.cls +0 -0
  85. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PrivateSession/Message/Poll.cls +0 -0
  86. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PrivateSession/Message/Start.cls +0 -0
  87. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/PrivateSession/Message/Stop.cls +0 -0
  88. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Service/Remote/Handler.cls +0 -0
  89. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Service/WSGI.cls +0 -0
  90. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Test.cls +0 -0
  91. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Utils.cls +0 -0
  92. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/cls/IOP/Wrapper.cls +0 -0
  93. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iop/wsgi/handlers.py +0 -0
  94. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +0 -0
  95. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  96. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  97. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  98. {iris_pex_embedded_python-3.5.2b1 → iris_pex_embedded_python-3.5.2b2}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.5.2b1
3
+ Version: 3.5.2b2
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 = "3.5.2b1"
6
+ version = "3.5.2b2"
7
7
  description = "Iris Interoperability based on Embedded Python"
8
8
  readme = "README.md"
9
9
  authors = [
@@ -264,9 +264,9 @@ class _Utils():
264
264
  def migrate_remote(filename=None):
265
265
  """
266
266
  Read a settings file from the filename
267
- If the settings.py file has a key 'REMOTE_SETTING' then it will use the value of that key
267
+ If the settings.py file has a key 'REMOTE_SETTINGS' then it will use the value of that key
268
268
  as the remote host to connect to.
269
- the REMOTE_SETTING is a RemoteSettings dictionary with the following keys:
269
+ the REMOTE_SETTINGS is a RemoteSettings dictionary with the following keys:
270
270
  * 'url': the host url to connect to (mandatory)
271
271
  * 'namespace': the namespace to use (optional, default is 'USER')
272
272
  * 'package': the package to use (optional, default is 'python')
@@ -285,7 +285,7 @@ class _Utils():
285
285
  'body' will be constructed with all the files in the folder if the folder is not empty else use root folder of settings.py
286
286
  """
287
287
  settings, path = _Utils._load_settings(filename)
288
- remote_settings: Optional[RemoteSettings] = getattr(settings, 'REMOTE_SETTING', None) if settings else None
288
+ remote_settings: Optional[RemoteSettings] = getattr(settings, 'REMOTE_SETTINGS', None) if settings else None
289
289
 
290
290
  if not remote_settings:
291
291
  _Utils.migrate(filename)
@@ -293,7 +293,7 @@ class _Utils():
293
293
 
294
294
  # Validate required fields
295
295
  if 'url' not in remote_settings:
296
- raise ValueError("REMOTE_SETTING must contain 'url' field")
296
+ raise ValueError("REMOTE_SETTINGS must contain 'url' field")
297
297
 
298
298
  # prepare the payload with defaults
299
299
  payload = {
@@ -333,11 +333,9 @@ class _Utils():
333
333
  timeout=10
334
334
  )
335
335
 
336
- # check the response status
337
- if response.status_code != 200:
338
- raise RuntimeError(f"Failed to migrate: {response.status_code} - {response.text}")
339
- else:
340
- print(f"Migration successful: {response.status_code} - {response.text}")
336
+ print(f"Response from remote migration: {response.text}")
337
+
338
+ response.raise_for_status() # Raise an error for bad responses
341
339
 
342
340
  @staticmethod
343
341
  def migrate(filename=None):
@@ -360,6 +358,8 @@ class _Utils():
360
358
 
361
359
  _Utils._cleanup_sys_path(path)
362
360
 
361
+ raise ValueError("Migration is not implemented yet. Please use the remote migration feature.")
362
+
363
363
  @staticmethod
364
364
  def _load_settings(filename):
365
365
  """Load settings module from file or default location.
@@ -18,6 +18,7 @@ ClassMethod CreateProjection(
18
18
  set webName = "/api/iop"
19
19
  set webProperties("NameSpace") = tCurrentNamespace
20
20
  set webProperties("Enabled") = 1
21
+ set webProperties("DispatchClass") = "IOP.Service.Remote.Handler"
21
22
  set webProperties("AutheEnabled") = 32
22
23
  set webProperties("ServeFiles")=2
23
24
  set webProperties("Recurse")=1
@@ -0,0 +1,97 @@
1
+ Class IOP.Service.Remote.Rest.v1 Extends %CSP.REST
2
+ {
3
+
4
+ XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
5
+ {
6
+ <Routes>
7
+ <Route Url="/migrate" Method="PUT" Call="PutMigrate"/>
8
+ <Route Url="/version" Method="GET" Call="GetVersion"/>
9
+ </Routes>
10
+ }
11
+
12
+ ClassMethod GetVersion() As %String
13
+ {
14
+ // Return the version of the IOP service
15
+ Return {
16
+ "version": "1.0.0",
17
+ "description": "Interoperability Embedded Python Service API"
18
+ }.%ToJSON()
19
+ }
20
+
21
+ ClassMethod NamespaceCheck(pNamespace As %String) As %Boolean [ Internal, Private ]
22
+ {
23
+ If '##class(%SYS.Namespace).Exists(pNamespace) {
24
+ throw $$$ERROR("NamespaceDoesNotExist")
25
+ }
26
+ Return 1
27
+ }
28
+
29
+ ClassMethod PutMigrate() As %DynamicObject
30
+ {
31
+ Try {
32
+ // Get the request body
33
+ set dyna = {}.%FromJSON(%request.Content)
34
+ set body = dyna.%Get("body")
35
+ set namespace = dyna.%Get("namespace")
36
+ set targetDirectory = dyna.%Get("remote_folder")
37
+ set packageName = dyna.%Get("package")
38
+ // check for namespace existence and user permissions against namespace
39
+ If '..NamespaceCheck(namespace) {
40
+ Return ""
41
+ }
42
+ New $NAMESPACE
43
+ Set $NAMESPACE = namespace
44
+
45
+
46
+ //Create directory for custom packages
47
+ If targetDirectory '= "" {
48
+ If '##class(%Library.File).DirectoryExists(targetDirectory) {
49
+ If '##class(%Library.File).CreateDirectory(targetDirectory) {
50
+ $$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, targetDirectory))
51
+ }
52
+ }
53
+ }
54
+ Else {
55
+ // Set targetDirectory to the CODE DATABASE directory
56
+ do ##class(%SYS.Namespace).GetAllNSInfo("USER",.info)
57
+ Set targetDirectory = info("RoutineDB","Directory")
58
+ }
59
+
60
+ Set packagePath = ##class(%Library.File).NormalizeDirectory(packageName, targetDirectory)
61
+ // If the package already exists then we must be meaning to re-load it. Delete files/directory/metadata and recreate fresh.
62
+ If ##class(%Library.File).DirectoryExists(packagePath) {
63
+ If '##class(%Library.File).RemoveDirectoryTree(packagePath) {
64
+ $$$ThrowStatus($$$ERROR($$$DirectoryPermission , packagePath))
65
+ }
66
+ }
67
+ If '##class(%Library.File).CreateDirectory(packagePath) {
68
+ $$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, packagePath))
69
+ }
70
+
71
+ //Unpack JSON objects
72
+ Set iterator = body.%GetIterator()
73
+ While iterator.%GetNext(.key , .fileObject ) {
74
+ // If fileObject.name has '/' then it is a path, we need to normalize it
75
+ Set fileName = ##class(%Library.File).NormalizeFilename(fileObject.name,packagePath)
76
+ do ##class(%Library.File).CreateDirectoryChain(##class(%Library.File).GetDirectory(fileName))
77
+ Set fileStream = ##class(%Stream.FileCharacter).%New()
78
+ Set fileStream.TranslateTable = "UTF8"
79
+ $$$ThrowOnError(fileStream.LinkToFile(fileName))
80
+ Do fileStream.Write(fileObject.data)
81
+ $$$ThrowOnError(fileStream.%Save())
82
+ }
83
+
84
+ //Do the iop migration
85
+
86
+ set iopUtils = ##class(IOP.Wrapper).Import("iop._utils")
87
+ do iopUtils."_Utils".migrate(##class(%Library.File).NormalizeFilename("settings.py", packagePath))
88
+ }
89
+ Catch ex {
90
+ $$$ThrowOnError(ex.AsStatus())
91
+ }
92
+
93
+
94
+ return $$$OK
95
+ }
96
+
97
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.5.2b1
3
+ Version: 3.5.2b2
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -1,90 +0,0 @@
1
- Class IOP.Service.Remote.Rest.v1 Extends %CSP.REST
2
- {
3
-
4
- XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
5
- {
6
- <Routes>
7
- <Route Url="/migrate" Method="PUT" Call="PutMigrate"/>
8
- <Route Url="/version" Method="GET" Call="GetVersion"/>
9
- </Routes>
10
- }
11
-
12
- ClassMethod GetVersion() As %String
13
- {
14
- // Return the version of the IOP service
15
- Return {
16
- "version": "1.0.0",
17
- "description": "Interoperability Embedded Python Service API"
18
- }.%ToJSON()
19
- }
20
-
21
- ClassMethod NamespaceCheck(pNamespace As %String) As %Boolean [ Internal, Private ]
22
- {
23
- If '##class(%SYS.Namespace).Exists(pNamespace) {
24
- throw $$$ERROR("NamespaceDoesNotExist")
25
- }
26
- Return 1
27
- }
28
-
29
- ClassMethod PutMigrate() As %DynamicObject
30
- {
31
- // Get the request body
32
- set dyna = {}.%FromJSON(%request.Content)
33
- set body = dyna.%Get("body")
34
- set namespace = dyna.%Get("namespace")
35
- set targetDirectory = dyna.%Get("remote_folder")
36
- set packageName = dyna.%Get("package")
37
- // check for namespace existence and user permissions against namespace
38
- If '..NamespaceCheck(namespace) {
39
- Return ""
40
- }
41
- New $NAMESPACE
42
- Set $NAMESPACE = namespace
43
-
44
-
45
- //Create directory for custom packages
46
- If targetDirectory '= "" {
47
- If '##class(%Library.File).DirectoryExists(targetDirectory) {
48
- If '##class(%Library.File).CreateDirectory(targetDirectory) {
49
- $$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, targetDirectory))
50
- }
51
- }
52
- }
53
- Else {
54
- // Set targetDirectory to the CODE DATABASE directory
55
- do ##class(%SYS.Namespace).GetAllNSInfo("USER",.info)
56
- Set targetDirectory = info("RoutineDB","Directory")
57
- }
58
-
59
- Set packagePath = ##class(%Library.File).NormalizeDirectory(packageName, targetDirectory)
60
- // If the package already exists then we must be meaning to re-load it. Delete files/directory/metadata and recreate fresh.
61
- If ##class(%Library.File).DirectoryExists(packagePath) {
62
- If '##class(%Library.File).RemoveDirectoryTree(packagePath) {
63
- $$$ThrowStatus($$$ERROR($$$DirectoryPermission , packagePath))
64
- }
65
- }
66
- If '##class(%Library.File).CreateDirectory(packagePath) {
67
- $$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, packagePath))
68
- }
69
-
70
- //Unpack JSON objects
71
- Set iterator = body.%GetIterator()
72
- While iterator.%GetNext(.key , .fileObject ) {
73
- // If fileObject.name has '/' then it is a path, we need to normalize it
74
- Set fileName = ##class(%Library.File).NormalizeFilename(fileObject.name,packagePath)
75
- do ##class(%Library.File).CreateDirectoryChain(##class(%Library.File).GetDirectory(fileName))
76
- Set fileStream = ##class(%Stream.FileCharacter).%New()
77
- Set fileStream.TranslateTable = "UTF8"
78
- $$$ThrowOnError(fileStream.LinkToFile(fileName))
79
- Do fileStream.Write(fileObject.data)
80
- $$$ThrowOnError(fileStream.%Save())
81
- }
82
-
83
- //Do the iop migration
84
- set iopUtils = ##class(IOP.Wrapper).Import("iop._utils")
85
- do iopUtils."_Utils".migrate(##class(%Library.File).NormalizeFilename("settings.py", packagePath))
86
-
87
- return $$$OK
88
- }
89
-
90
- }