iris-pex-embedded-python 3.5.2b1__py3-none-any.whl → 3.5.2b2__py3-none-any.whl

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.

iop/_utils.py CHANGED
@@ -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
@@ -28,61 +28,68 @@ ClassMethod NamespaceCheck(pNamespace As %String) As %Boolean [ Internal, Privat
28
28
 
29
29
  ClassMethod PutMigrate() As %DynamicObject
30
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
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
43
44
 
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))
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())
64
82
  }
65
- }
66
- If '##class(%Library.File).CreateDirectory(packagePath) {
67
- $$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, packagePath))
68
- }
69
83
 
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())
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())
81
91
  }
82
92
 
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
93
 
87
94
  return $$$OK
88
95
  }
@@ -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
@@ -51,7 +51,7 @@ iop/_private_session_duplex.py,sha256=c6Q0k-qnZi_JcIOdpUx1Edu44zVbUE2Kf2aCHM8Eq8
51
51
  iop/_private_session_process.py,sha256=rvZFO6nWVwZtaEWJkSHyLTV-vhzDqQhsVi7INQLLwWI,1685
52
52
  iop/_remote.py,sha256=gCXXK67RFP8njSnbEsZdsOl9Rlt8TYtBDiHr3rwRvLA,3789
53
53
  iop/_serialization.py,sha256=C9-88bb6vC8A4ugQ3QqjahAbv7NjAD2sZy8_D-X0Ois,7721
54
- iop/_utils.py,sha256=UBeWhSZo1Ya4_f3fgyRhC2zYc5TFGLF6BuhrO3EPmBk,27012
54
+ iop/_utils.py,sha256=o9GDlLAx7BEEv_4dsYGeYMnIsQHQ3jmueIRlW1HPICk,26989
55
55
  iop/cls/IOP/BusinessOperation.cls,sha256=td4tFxy9KbZ6u5QEr9xCuCNjcqEJavdeYHErNrt-szk,941
56
56
  iop/cls/IOP/BusinessProcess.cls,sha256=XJxzbiV0xokzRm-iI2Be5UIJLE3MlXr7W3WS_LkOCYs,3363
57
57
  iop/cls/IOP/BusinessService.cls,sha256=fplKrbQgA7cQgjKIqDR2IK2iD1iNHmT-QvWrozhE4n4,1189
@@ -61,7 +61,7 @@ iop/cls/IOP/InboundAdapter.cls,sha256=H-gZfUy8M9YxAZXfp5HVYl3uLo-7Xg9YgojioB_eYM
61
61
  iop/cls/IOP/Message.cls,sha256=6_iZzQaY0cA9FjXg0qECYZC6We8soAIrUwRBrlerC4w,25373
62
62
  iop/cls/IOP/OutboundAdapter.cls,sha256=OQoGFHUy2qV_kcsShTlWGOngDrdH5dhwux4eopZyIv4,967
63
63
  iop/cls/IOP/PickleMessage.cls,sha256=S3y7AClQ8mAILjxPuHdCjGosBZYzGbUQ5WTv4mYPNMQ,1673
64
- iop/cls/IOP/Projection.cls,sha256=9pKPm5SLAKmTnrcJWwLo9kPycWJsiT-YVYnQIqzNN1U,1241
64
+ iop/cls/IOP/Projection.cls,sha256=AZgbfpbEk02llhyIwrSw0M3QMcQNcjhjY3_vU_yx8FU,1315
65
65
  iop/cls/IOP/Test.cls,sha256=gAC9PEfMZsvAEWIa241-ug2FWAhITbN1SOispZzJPnI,2094
66
66
  iop/cls/IOP/Utils.cls,sha256=NGnfi2Kif3OyYwR6pm5c_-UKm5vEwQyfzvJpZGxFeeA,18546
67
67
  iop/cls/IOP/Wrapper.cls,sha256=37fUol-EcktdfGhpfi4o12p04975lKGaRYEFhw-fuaM,1614
@@ -81,11 +81,11 @@ iop/cls/IOP/PrivateSession/Message/Start.cls,sha256=RsJLrhglrONBDGT0RqW2K9MDXa98
81
81
  iop/cls/IOP/PrivateSession/Message/Stop.cls,sha256=7g3gKFUjNg0WXBLuWnj-VnCs5G6hSE09YTzGEp0zbGc,1390
82
82
  iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,10440
83
83
  iop/cls/IOP/Service/Remote/Handler.cls,sha256=JfsXse2jvoVvQfW8_rVEt2DCQJ9SVqReCcOUngOkpzE,938
84
- iop/cls/IOP/Service/Remote/Rest/v1.cls,sha256=LR8nUIEvGb7bO1AwiVMeh70RGePwhPt7sHYGGfR9coA,3033
84
+ iop/cls/IOP/Service/Remote/Rest/v1.cls,sha256=JWORGJR7Z_Sc8BBevke14GAnLuWdQTuCSPjillOrQZU,3052
85
85
  iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
86
- iris_pex_embedded_python-3.5.2b1.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
87
- iris_pex_embedded_python-3.5.2b1.dist-info/METADATA,sha256=2v-X7ose-o8tZwWw-8nA1X-nbdSfIKxMOuUQ62HqOIg,4415
88
- iris_pex_embedded_python-3.5.2b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
89
- iris_pex_embedded_python-3.5.2b1.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
90
- iris_pex_embedded_python-3.5.2b1.dist-info/top_level.txt,sha256=4p0q6hCATmYIVMVi3I8hOUcJE1kwzyBeHygWv_rGvrU,13
91
- iris_pex_embedded_python-3.5.2b1.dist-info/RECORD,,
86
+ iris_pex_embedded_python-3.5.2b2.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
87
+ iris_pex_embedded_python-3.5.2b2.dist-info/METADATA,sha256=8hj5wWSEjq5pIyXXmVHDFFtgHOh0b9KIQbPZKT_c-ac,4415
88
+ iris_pex_embedded_python-3.5.2b2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
89
+ iris_pex_embedded_python-3.5.2b2.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
90
+ iris_pex_embedded_python-3.5.2b2.dist-info/top_level.txt,sha256=4p0q6hCATmYIVMVi3I8hOUcJE1kwzyBeHygWv_rGvrU,13
91
+ iris_pex_embedded_python-3.5.2b2.dist-info/RECORD,,