iris-pex-embedded-python 2.3.20__tar.gz → 2.3.21__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.
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/PKG-INFO +3 -1
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/pyproject.toml +1 -1
- iris_pex_embedded_python-2.3.21/src/intersystems_iris/_IRISOREF.py +9 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_DBAPI.py +16 -1
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_Parameter.py +2 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/PKG-INFO +3 -1
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +1 -13
- iris_pex_embedded_python-2.3.20/src/intersystems_iris/_IRISOREF.py +0 -4
- iris_pex_embedded_python-2.3.20/src/iris/iris_site.py +0 -13
- iris_pex_embedded_python-2.3.20/src/iris/irisbuiltins.py +0 -97
- iris_pex_embedded_python-2.3.20/src/iris/irisloader.py +0 -199
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/adapter.py +0 -56
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/bo.py +0 -140
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/bp.py +0 -21
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/bs.py +0 -117
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/edge/bs-dash.py +0 -7
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/edge/bs_underscore.py +0 -7
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/message.py +0 -57
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/obj.py +0 -10
- iris_pex_embedded_python-2.3.20/src/tests/registerFiles/settings.py +0 -75
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/LICENSE +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/README.md +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/setup.cfg +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/setup.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/cls/Grongier/Service/WSGI.cls +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/__main__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_business_host.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_business_operation.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_business_process.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_business_service.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_cli.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_common.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_director.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_inbound_adapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_message.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_outbound_adapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_pickle_message.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_private_session_duplex.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_private_session_process.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/_utils.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/grongier/pex/wsgi/handlers.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_BufferReader.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_BufferWriter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_ConnectionInformation.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_ConnectionParameters.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_Constant.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_DBList.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_Device.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_GatewayContext.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_GatewayException.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_GatewayUtility.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRIS.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISConnection.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISEmbedded.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISGlobalNode.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISGlobalNodeView.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISIterator.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISList.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISNative.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISObject.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_IRISReference.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_InStream.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_LegacyIterator.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_ListItem.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_ListReader.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_ListWriter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_LogFileStream.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_MessageHeader.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_OutStream.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_PrintStream.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_PythonGateway.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/_SharedMemorySocket.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/__main__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_Column.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_Descriptor.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_IRISStream.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_Message.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_ParameterCollection.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_ResultSetRow.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/_SQLType.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/preparser/_PreParser.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/preparser/_Scanner.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/preparser/_Token.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/preparser/_TokenList.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/dbapi/preparser/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_BusinessHost.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_BusinessOperation.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_BusinessProcess.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_BusinessService.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_Common.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_Director.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_IRISBusinessOperation.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_IRISBusinessService.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_IRISInboundAdapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_IRISOutboundAdapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_InboundAdapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_Message.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/_OutboundAdapter.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/intersystems_iris/pex/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris/__init__.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris/iris_ipm.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/src/irisnative/_IRISNative.py +0 -0
- {iris_pex_embedded_python-2.3.20 → iris_pex_embedded_python-2.3.21}/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.
|
|
3
|
+
Version: 2.3.21
|
|
4
4
|
Summary: Iris Interoperability based on Embedded Python
|
|
5
5
|
Author-email: grongier <guillaume.rongier@intersystems.com>
|
|
6
6
|
License: MIT License
|
|
@@ -43,6 +43,8 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
43
43
|
Classifier: Topic :: Utilities
|
|
44
44
|
Description-Content-Type: text/markdown
|
|
45
45
|
License-File: LICENSE
|
|
46
|
+
Requires-Dist: dacite>=1.6.0
|
|
47
|
+
Requires-Dist: xmltodict>=0.12.0
|
|
46
48
|
|
|
47
49
|
# 1. interoperability-embedded-python
|
|
48
50
|
|
|
@@ -19,6 +19,7 @@ from intersystems_iris.dbapi._IRISStream import (
|
|
|
19
19
|
IRISStream,
|
|
20
20
|
IRISBinaryStream,
|
|
21
21
|
)
|
|
22
|
+
from intersystems_iris._IRISOREF import _IRISOREF
|
|
22
23
|
from ._SQLType import SQLType
|
|
23
24
|
|
|
24
25
|
from .._IRISNative import connect as native_connect
|
|
@@ -648,7 +649,11 @@ class _BaseCursor:
|
|
|
648
649
|
|
|
649
650
|
def _update404(self):
|
|
650
651
|
with self._connection._lock:
|
|
652
|
+
# self._reset_cached_info()
|
|
651
653
|
self._validate_parameters()
|
|
654
|
+
# self._prepare()
|
|
655
|
+
# self._validate_prepared_parameters()
|
|
656
|
+
# self._prepared_update_execute()
|
|
652
657
|
self._send_direct_update_request()
|
|
653
658
|
|
|
654
659
|
# api properties and methods
|
|
@@ -752,6 +757,12 @@ class Cursor(_BaseCursor):
|
|
|
752
757
|
return True
|
|
753
758
|
else:
|
|
754
759
|
return False
|
|
760
|
+
|
|
761
|
+
def _reset_cached_info(self):
|
|
762
|
+
if not self._connection._preparedCache or not hasattr(self._connection._preparedCache, "__iter__"):
|
|
763
|
+
return
|
|
764
|
+
if self._parsed_statement in self._connection._preparedCache:
|
|
765
|
+
del self._connection._preparedCache[self._parsed_statement]
|
|
755
766
|
|
|
756
767
|
def _prepare_cached(self, cached_statement):
|
|
757
768
|
self._statement_id = cached_statement.statement_id
|
|
@@ -1181,11 +1192,15 @@ class Cursor(_BaseCursor):
|
|
|
1181
1192
|
self.params[pi] = stream_oref
|
|
1182
1193
|
|
|
1183
1194
|
def _send_stream(self, param_type, value):
|
|
1195
|
+
if isinstance(value, _IRISOREF):
|
|
1196
|
+
return value
|
|
1184
1197
|
if not isinstance(value, str) and not isinstance(value, bytes):
|
|
1185
1198
|
raise Exception(f"Invalid value type for stream, got {type(value).__name__}, expected str or bytes")
|
|
1186
1199
|
stream_oref = None
|
|
1187
1200
|
offset = 0
|
|
1188
1201
|
full_size = len(value)
|
|
1202
|
+
if full_size < 3 * 1024 * 1024:
|
|
1203
|
+
return value
|
|
1189
1204
|
with self._connection._lock:
|
|
1190
1205
|
while True:
|
|
1191
1206
|
size = full_size
|
|
@@ -1216,7 +1231,7 @@ class Cursor(_BaseCursor):
|
|
|
1216
1231
|
self._in_message._read_message_sql(sequence_number, self._statement_id, 0)
|
|
1217
1232
|
stream_oref = self._sqlcode = self._in_message.wire._get()
|
|
1218
1233
|
|
|
1219
|
-
return stream_oref
|
|
1234
|
+
return _IRISOREF(stream_oref)
|
|
1220
1235
|
|
|
1221
1236
|
def _prepared_update_execute(self):
|
|
1222
1237
|
self._update_streams()
|
|
@@ -2,6 +2,7 @@ import datetime
|
|
|
2
2
|
import decimal
|
|
3
3
|
import enum
|
|
4
4
|
import intersystems_iris.dbapi._Descriptor
|
|
5
|
+
from intersystems_iris._IRISOREF import _IRISOREF
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class ParameterMode(enum.IntEnum):
|
|
@@ -110,6 +111,7 @@ class _Parameter(intersystems_iris.dbapi._Descriptor._Descriptor):
|
|
|
110
111
|
int: lambda v: v,
|
|
111
112
|
float: lambda v: v,
|
|
112
113
|
decimal.Decimal: lambda v: v,
|
|
114
|
+
_IRISOREF: lambda v: str(v),
|
|
113
115
|
}
|
|
114
116
|
func = None
|
|
115
117
|
if issubclass(type(self.__value), enum.Enum):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: iris-pex-embedded-python
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.21
|
|
4
4
|
Summary: Iris Interoperability based on Embedded Python
|
|
5
5
|
Author-email: grongier <guillaume.rongier@intersystems.com>
|
|
6
6
|
License: MIT License
|
|
@@ -43,6 +43,8 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
43
43
|
Classifier: Topic :: Utilities
|
|
44
44
|
Description-Content-Type: text/markdown
|
|
45
45
|
License-File: LICENSE
|
|
46
|
+
Requires-Dist: dacite>=1.6.0
|
|
47
|
+
Requires-Dist: xmltodict>=0.12.0
|
|
46
48
|
|
|
47
49
|
# 1. interoperability-embedded-python
|
|
48
50
|
|
|
@@ -105,9 +105,6 @@ src/intersystems_iris/pex/_OutboundAdapter.py
|
|
|
105
105
|
src/intersystems_iris/pex/__init__.py
|
|
106
106
|
src/iris/__init__.py
|
|
107
107
|
src/iris/iris_ipm.py
|
|
108
|
-
src/iris/iris_site.py
|
|
109
|
-
src/iris/irisbuiltins.py
|
|
110
|
-
src/iris/irisloader.py
|
|
111
108
|
src/iris_pex_embedded_python.egg-info/PKG-INFO
|
|
112
109
|
src/iris_pex_embedded_python.egg-info/SOURCES.txt
|
|
113
110
|
src/iris_pex_embedded_python.egg-info/dependency_links.txt
|
|
@@ -115,13 +112,4 @@ src/iris_pex_embedded_python.egg-info/entry_points.txt
|
|
|
115
112
|
src/iris_pex_embedded_python.egg-info/requires.txt
|
|
116
113
|
src/iris_pex_embedded_python.egg-info/top_level.txt
|
|
117
114
|
src/irisnative/_IRISNative.py
|
|
118
|
-
src/irisnative/__init__.py
|
|
119
|
-
src/tests/registerFiles/adapter.py
|
|
120
|
-
src/tests/registerFiles/bo.py
|
|
121
|
-
src/tests/registerFiles/bp.py
|
|
122
|
-
src/tests/registerFiles/bs.py
|
|
123
|
-
src/tests/registerFiles/message.py
|
|
124
|
-
src/tests/registerFiles/obj.py
|
|
125
|
-
src/tests/registerFiles/settings.py
|
|
126
|
-
src/tests/registerFiles/edge/bs-dash.py
|
|
127
|
-
src/tests/registerFiles/edge/bs_underscore.py
|
|
115
|
+
src/irisnative/__init__.py
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from os import sep as __os_sep
|
|
3
|
-
from site import getsitepackages as __sitegetsitepackages
|
|
4
|
-
|
|
5
|
-
#ubuntu needs dist-packages for pandas to be able to be imported
|
|
6
|
-
#ubu 18 doesnt have os.sep in sys.executable
|
|
7
|
-
def set_site_path(platform_name):
|
|
8
|
-
if "ubuntu" in platform_name:
|
|
9
|
-
if __os_sep in sys.executable:
|
|
10
|
-
__siteprefixes = [__os_sep + sys.executable.split(__os_sep)[1]]
|
|
11
|
-
else:
|
|
12
|
-
__siteprefixes = ['/usr']
|
|
13
|
-
sys.path = sys.path + __sitegetsitepackages(__siteprefixes)
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from collections import abc
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# IRIS Exceptions
|
|
5
|
-
#
|
|
6
|
-
class SQLError(Exception):
|
|
7
|
-
"""Error raised on an invalid IRIS SQL statement
|
|
8
|
-
|
|
9
|
-
Attributes:
|
|
10
|
-
sqlcode -- IRIS SQL error code
|
|
11
|
-
message -- Error description
|
|
12
|
-
statement -- Statement that failed
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def __init__(self,sqlcode,message,statement=None):
|
|
16
|
-
self.sqlcode = sqlcode
|
|
17
|
-
self.message = message
|
|
18
|
-
self.statement = statement
|
|
19
|
-
super().__init__(self.message)
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
# Helper to raise a properly formatted AttributeError when we decide that
|
|
23
|
-
# we don't want to handle a last-chance method.
|
|
24
|
-
#
|
|
25
|
-
def _no_such_method(target,method):
|
|
26
|
-
raise AttributeError(f"'{target.__class__.__name__}' has no attribute '{method}'")
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# irisbuiltins: Implements impedence matching methods for projecting IRIS behavior
|
|
30
|
-
# over Python objects.
|
|
31
|
-
#
|
|
32
|
-
class irisbuiltins:
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
# Common functions for mapping Python collection behavior to IRIS behavior
|
|
36
|
-
#
|
|
37
|
-
# NOTE: With Sequences, the indicies are 0 based for Python and 1 based
|
|
38
|
-
# for IRIS.
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
def Count(self):
|
|
42
|
-
if isinstance(self,abc.Mapping) or isinstance(self,abc.Sequence):
|
|
43
|
-
return len(self)
|
|
44
|
-
_no_such_method(self,"Count")
|
|
45
|
-
|
|
46
|
-
def GetAt(self,index):
|
|
47
|
-
if isinstance(self,abc.Mapping):
|
|
48
|
-
return self[index]
|
|
49
|
-
if isinstance(self,abc.Sequence):
|
|
50
|
-
return self[index-1]
|
|
51
|
-
_no_such_method(self,"GetAt")
|
|
52
|
-
|
|
53
|
-
def SetAt(self,value,index):
|
|
54
|
-
if isinstance(self,abc.Mapping):
|
|
55
|
-
self[index] = value
|
|
56
|
-
return
|
|
57
|
-
if isinstance(self,abc.Sequence):
|
|
58
|
-
self[index-1] = value
|
|
59
|
-
return
|
|
60
|
-
_no_such_method(self,"SetAt")
|
|
61
|
-
|
|
62
|
-
def Insert(self,value):
|
|
63
|
-
if isinstance(self,abc.Sequence):
|
|
64
|
-
self.append(value)
|
|
65
|
-
return
|
|
66
|
-
_no_such_method(self,"Insert")
|
|
67
|
-
|
|
68
|
-
def InsertAt(self,value,index):
|
|
69
|
-
if isinstance(self,abc.Sequence):
|
|
70
|
-
self.insert(index-1,value)
|
|
71
|
-
return
|
|
72
|
-
_no_such_method(self,"InsertAt")
|
|
73
|
-
|
|
74
|
-
def Clear(self):
|
|
75
|
-
if isinstance(self,abc.Mapping) or isinstance(self,abc.Sequence):
|
|
76
|
-
self.clear()
|
|
77
|
-
return
|
|
78
|
-
_no_such_method(self,"Clear")
|
|
79
|
-
|
|
80
|
-
def IsDefined(self,key):
|
|
81
|
-
if isinstance(self,abc.Mapping):
|
|
82
|
-
return (key in self)
|
|
83
|
-
_no_such_method(self,"IsDefined")
|
|
84
|
-
|
|
85
|
-
def Find(self,value):
|
|
86
|
-
if isinstance(self,abc.Sequence):
|
|
87
|
-
return self.index(value)+1
|
|
88
|
-
if isinstance(self,abc.Mapping):
|
|
89
|
-
for (k,v) in self.items():
|
|
90
|
-
if v == value:
|
|
91
|
-
return k
|
|
92
|
-
return None;
|
|
93
|
-
_no_such_method(self,"Find")
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
# End-of-file
|
|
97
|
-
#
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
from importlib.abc import MetaPathFinder
|
|
2
|
-
from importlib.abc import Loader
|
|
3
|
-
import importlib
|
|
4
|
-
from types import ModuleType
|
|
5
|
-
import math
|
|
6
|
-
import marshal
|
|
7
|
-
import sys
|
|
8
|
-
import iris
|
|
9
|
-
|
|
10
|
-
sources=iris.gref("^ROUTINE")
|
|
11
|
-
binaries=iris.gref("^rPYC")
|
|
12
|
-
MAX_STRING_SIZE=3800000
|
|
13
|
-
|
|
14
|
-
def getFromDirectory(directory, path):
|
|
15
|
-
level=len(path)
|
|
16
|
-
if level == 1:
|
|
17
|
-
return directory[path[0]]
|
|
18
|
-
elif level == 2:
|
|
19
|
-
return directory[path[0],path[1]]
|
|
20
|
-
elif level == 3:
|
|
21
|
-
return directory[path[0],path[1],path[2]]
|
|
22
|
-
elif level == 4:
|
|
23
|
-
return directory[path[0],path[1],path[2],path[3]]
|
|
24
|
-
elif level == 5:
|
|
25
|
-
return directory[path[0],path[1],path[2],path[3],path[4]]
|
|
26
|
-
elif level == 6:
|
|
27
|
-
return directory[path[0],path[1],path[2],path[3],path[4],path[5]]
|
|
28
|
-
elif level == 7:
|
|
29
|
-
return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6]]
|
|
30
|
-
elif level == 8:
|
|
31
|
-
return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6],path[7]]
|
|
32
|
-
elif level == 9:
|
|
33
|
-
return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6],path[7],path[8]]
|
|
34
|
-
|
|
35
|
-
#name is name of rtn with .py
|
|
36
|
-
def getSourceCode(name):
|
|
37
|
-
currentP = [name] + [0,0]
|
|
38
|
-
length = getFromDirectory(sources, currentP)
|
|
39
|
-
currentP.pop()
|
|
40
|
-
if not length or length == 0:
|
|
41
|
-
return None
|
|
42
|
-
code = ""
|
|
43
|
-
for i in range(1,int(length)+1):
|
|
44
|
-
currentP.append(i)
|
|
45
|
-
code += getFromDirectory(sources, currentP)
|
|
46
|
-
code += "\r\n"
|
|
47
|
-
currentP.pop()
|
|
48
|
-
return code
|
|
49
|
-
|
|
50
|
-
def getCodeFromBinary(name):
|
|
51
|
-
length = binaries.get([name],0)
|
|
52
|
-
if (length < 1):
|
|
53
|
-
return None
|
|
54
|
-
codeBytes = binaries.getAsBytes([name,1])
|
|
55
|
-
for i in range(1,int(length)):
|
|
56
|
-
codeBytes += binaries.getAsBytes([name,i+1])
|
|
57
|
-
return marshal.loads(codeBytes)
|
|
58
|
-
|
|
59
|
-
# def checkCode(directory, path):
|
|
60
|
-
# currentP = [p for p in path] + [0,0]
|
|
61
|
-
# length = getFromDirectory(directory, currentP)
|
|
62
|
-
# currentP.pop()
|
|
63
|
-
# if not length or length == 0:
|
|
64
|
-
# return None
|
|
65
|
-
# return length
|
|
66
|
-
|
|
67
|
-
def checkCode(name):
|
|
68
|
-
#code exist for module
|
|
69
|
-
|
|
70
|
-
if binaries.get([name],0) > 0:
|
|
71
|
-
return True
|
|
72
|
-
sub = binaries.order([name+"."])
|
|
73
|
-
#there exists some subpackage
|
|
74
|
-
if (sub and sub[:len(name)] == name):
|
|
75
|
-
return True
|
|
76
|
-
return False
|
|
77
|
-
|
|
78
|
-
def compileCode(name):
|
|
79
|
-
path = name.split(".")
|
|
80
|
-
classname = path[-1]
|
|
81
|
-
code = getSourceCode(name+".py")
|
|
82
|
-
if code:
|
|
83
|
-
codeobj = compile(code,classname,"exec")
|
|
84
|
-
compiledpython = marshal.dumps(codeobj)
|
|
85
|
-
|
|
86
|
-
#store in database
|
|
87
|
-
length=len(compiledpython)
|
|
88
|
-
chunks = math.ceil(length / MAX_STRING_SIZE)
|
|
89
|
-
binaries[name] = chunks
|
|
90
|
-
for i in range(chunks):
|
|
91
|
-
binaries[name,i+1] = compiledpython[i*MAX_STRING_SIZE:min(MAX_STRING_SIZE*(i+1),length)]
|
|
92
|
-
|
|
93
|
-
#delete old version of this module
|
|
94
|
-
# if name in sys.modules:
|
|
95
|
-
# del sys.modules[name]
|
|
96
|
-
return 1
|
|
97
|
-
return 0
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
# Impedence matcher prototype
|
|
101
|
-
#
|
|
102
|
-
|
|
103
|
-
def mapping_GetAt(self,key):
|
|
104
|
-
return self[key]
|
|
105
|
-
|
|
106
|
-
def mapping_SetAt(self,value,key):
|
|
107
|
-
self[key] = value
|
|
108
|
-
|
|
109
|
-
def sequence_GetAt(self,index):
|
|
110
|
-
return self[index-1]
|
|
111
|
-
|
|
112
|
-
def sequence_SetAt(self,value,index):
|
|
113
|
-
self[index-1] = value
|
|
114
|
-
|
|
115
|
-
def materialize(obj):
|
|
116
|
-
if isinstance(obj,collections.abc.Mapping):
|
|
117
|
-
obj.Count = obj.__len__
|
|
118
|
-
obj.GetAt = mapping_GetAt
|
|
119
|
-
obj.SetAt = mapping_SetAt
|
|
120
|
-
return True
|
|
121
|
-
if isinstance(obj,collections.abc.Sequence):
|
|
122
|
-
obj.Count = obj.__len__
|
|
123
|
-
obj.GetAt = sequence_GetAt
|
|
124
|
-
obj.SetAt = sequence_SetAt
|
|
125
|
-
return True
|
|
126
|
-
return False
|
|
127
|
-
|
|
128
|
-
class MyLoader(Loader):
|
|
129
|
-
def create_module(self,spec):
|
|
130
|
-
|
|
131
|
-
module = ModuleType(spec.name)
|
|
132
|
-
module.__spec__=spec
|
|
133
|
-
module.__loader__ = self
|
|
134
|
-
module.__path__ = spec.__path__
|
|
135
|
-
return module
|
|
136
|
-
|
|
137
|
-
def exec_module(self, module):
|
|
138
|
-
#path = [p+".py" for p in module.__path__]
|
|
139
|
-
name = ""
|
|
140
|
-
code = None
|
|
141
|
-
for n in module.__path__:
|
|
142
|
-
name += n
|
|
143
|
-
name += "."
|
|
144
|
-
if name:
|
|
145
|
-
code = getCodeFromBinary(name[:len(name)-1])
|
|
146
|
-
|
|
147
|
-
#this is a class or has code by itself
|
|
148
|
-
if code:
|
|
149
|
-
#print(marshal.loads(bytes(code,"utf-8")))
|
|
150
|
-
#print(type(code))
|
|
151
|
-
exec(code,module.__dict__)
|
|
152
|
-
#this is a module
|
|
153
|
-
# ismodule = getFromDirectory(path+["catalog"])
|
|
154
|
-
# if ismodule:
|
|
155
|
-
# for s in ismodule.split(","):
|
|
156
|
-
# code = getFromDirectory(path+[s])
|
|
157
|
-
# if code:
|
|
158
|
-
# exec(code,module.__dict__)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
class MyFinder(MetaPathFinder):
|
|
162
|
-
def __init__(self):
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
def find_spec(self,fullname,path,target=None):
|
|
166
|
-
|
|
167
|
-
#print("importing1: "+fullname)
|
|
168
|
-
ans = fullname.split(".")
|
|
169
|
-
currentName=ans[-1]
|
|
170
|
-
for i in range(len(ans)):
|
|
171
|
-
ans[i] += ".py"
|
|
172
|
-
#validate existance from globals
|
|
173
|
-
#this might be wrong
|
|
174
|
-
if not checkCode(fullname):
|
|
175
|
-
return None
|
|
176
|
-
spec = importlib.machinery.ModuleSpec(fullname, MyLoader())
|
|
177
|
-
#update path
|
|
178
|
-
if path:
|
|
179
|
-
spec.__path__ = path + [currentName]
|
|
180
|
-
else:
|
|
181
|
-
spec.__path__ = [currentName]
|
|
182
|
-
# set parent
|
|
183
|
-
if len(ans) == 1:
|
|
184
|
-
if path:
|
|
185
|
-
spec.__parent__=path[-1]
|
|
186
|
-
else:
|
|
187
|
-
spec.__parent__= None
|
|
188
|
-
else:
|
|
189
|
-
spec.__parent__=ans[-1]
|
|
190
|
-
|
|
191
|
-
return spec
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
sys.meta_path.append(MyFinder())
|
|
195
|
-
#del sys
|
|
196
|
-
#test:
|
|
197
|
-
#s imp = ##class(%SYS.Python).Import("customImport")
|
|
198
|
-
#s xx = ##class(%SYS.Python).Import("User")
|
|
199
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import grongier.pex
|
|
2
|
-
import requests
|
|
3
|
-
import iris
|
|
4
|
-
import json
|
|
5
|
-
|
|
6
|
-
class RedditInboundAdapter(grongier.pex.InboundAdapter):
|
|
7
|
-
|
|
8
|
-
def OnInit(self):
|
|
9
|
-
|
|
10
|
-
if not hasattr(self,'Feed'):
|
|
11
|
-
self.Feed = "/new/"
|
|
12
|
-
|
|
13
|
-
if self.Limit is None:
|
|
14
|
-
raise TypeError('no Limit field')
|
|
15
|
-
|
|
16
|
-
self.LastPostName = ""
|
|
17
|
-
|
|
18
|
-
return 1
|
|
19
|
-
|
|
20
|
-
def OnTask(self):
|
|
21
|
-
self.LOGINFO(f"LIMIT:{self.Limit}")
|
|
22
|
-
if self.Feed == "" :
|
|
23
|
-
return 1
|
|
24
|
-
|
|
25
|
-
tSC = 1
|
|
26
|
-
# HTTP Request
|
|
27
|
-
try:
|
|
28
|
-
server = "https://www.reddit.com"
|
|
29
|
-
requestString = self.Feed+".json?before="+self.LastPostName+"&limit="+self.Limit
|
|
30
|
-
self.LOGINFO(server+requestString)
|
|
31
|
-
response = requests.get(server+requestString)
|
|
32
|
-
response.raise_for_status()
|
|
33
|
-
|
|
34
|
-
data = response.json()
|
|
35
|
-
updateLast = 0
|
|
36
|
-
|
|
37
|
-
for key, value in enumerate(data['data']['children']):
|
|
38
|
-
if value['data']['selftext']=="":
|
|
39
|
-
continue
|
|
40
|
-
post = iris.cls('dc.Reddit.Post')._New()
|
|
41
|
-
post._JSONImport(json.dumps(value['data']))
|
|
42
|
-
post.OriginalJSON = json.dumps(value)
|
|
43
|
-
if not updateLast:
|
|
44
|
-
self.LastPostName = value['data']['name']
|
|
45
|
-
updateLast = 1
|
|
46
|
-
response = self.BusinessHost.ProcessInput(post)
|
|
47
|
-
except requests.exceptions.HTTPError as err:
|
|
48
|
-
if err.response.status_code == 429:
|
|
49
|
-
self.LOGWARNING(err.__str__())
|
|
50
|
-
else:
|
|
51
|
-
raise err
|
|
52
|
-
except Exception as err:
|
|
53
|
-
self.LOGERROR(err.__str__())
|
|
54
|
-
raise err
|
|
55
|
-
|
|
56
|
-
return tSC
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
from grongier.pex import BusinessOperation
|
|
4
|
-
|
|
5
|
-
import iris
|
|
6
|
-
|
|
7
|
-
from message import MyResponse
|
|
8
|
-
|
|
9
|
-
import os
|
|
10
|
-
import datetime
|
|
11
|
-
import smtplib
|
|
12
|
-
from email.mime.text import MIMEText
|
|
13
|
-
|
|
14
|
-
class EmailOperation(BusinessOperation):
|
|
15
|
-
|
|
16
|
-
def OnMessage(self, pRequest):
|
|
17
|
-
|
|
18
|
-
sender = 'admin@example.com'
|
|
19
|
-
receivers = [ pRequest.ToEmailAddress ]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
port = 1025
|
|
23
|
-
msg = MIMEText('This is test mail')
|
|
24
|
-
|
|
25
|
-
msg['Subject'] = pRequest.Found+" found"
|
|
26
|
-
msg['From'] = 'admin@example.com'
|
|
27
|
-
msg['To'] = pRequest.ToEmailAddress
|
|
28
|
-
|
|
29
|
-
with smtplib.SMTP('localhost', port) as server:
|
|
30
|
-
|
|
31
|
-
# server.login('username', 'password')
|
|
32
|
-
server.sendmail(sender, receivers, msg.as_string())
|
|
33
|
-
print("Successfully sent email")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class EmailOperationWithIrisAdapter(BusinessOperation):
|
|
38
|
-
|
|
39
|
-
def get_adapter_type():
|
|
40
|
-
"""
|
|
41
|
-
Name of the registred Adapter
|
|
42
|
-
"""
|
|
43
|
-
return "EnsLib.EMail.OutboundAdapter"
|
|
44
|
-
|
|
45
|
-
def OnMessage(self, pRequest):
|
|
46
|
-
|
|
47
|
-
mailMessage = iris.cls("%Net.MailMessage")._New()
|
|
48
|
-
mailMessage.Subject = pRequest.Found+" found"
|
|
49
|
-
self.Adapter.AddRecipients(mailMessage,pRequest.ToEmailAddress)
|
|
50
|
-
mailMessage.Charset="UTF-8"
|
|
51
|
-
|
|
52
|
-
title = author = url = ""
|
|
53
|
-
if (pRequest.Post is not None) :
|
|
54
|
-
title = pRequest.Post.title
|
|
55
|
-
author = pRequest.Post.author
|
|
56
|
-
url = pRequest.Post.url
|
|
57
|
-
|
|
58
|
-
mailMessage.TextData.WriteLine("More info:")
|
|
59
|
-
mailMessage.TextData.WriteLine("Title: "+title)
|
|
60
|
-
mailMessage.TextData.WriteLine("Author: "+author)
|
|
61
|
-
mailMessage.TextData.WriteLine("URL: "+url)
|
|
62
|
-
|
|
63
|
-
return self.Adapter.SendMail(mailMessage)
|
|
64
|
-
|
|
65
|
-
class FileOperation(BusinessOperation):
|
|
66
|
-
|
|
67
|
-
def OnInit(self):
|
|
68
|
-
if hasattr(self,'Path'):
|
|
69
|
-
os.chdir(self.Path)
|
|
70
|
-
|
|
71
|
-
def OnMessage(self, pRequest):
|
|
72
|
-
|
|
73
|
-
ts = title = author = url = text = ""
|
|
74
|
-
|
|
75
|
-
if (pRequest.Post is not None):
|
|
76
|
-
title = pRequest.Post.Title
|
|
77
|
-
author = pRequest.Post.Author
|
|
78
|
-
url = pRequest.Post.Url
|
|
79
|
-
text = pRequest.Post.Selftext
|
|
80
|
-
ts = datetime.datetime.fromtimestamp(pRequest.Post.CreatedUTC).__str__()
|
|
81
|
-
|
|
82
|
-
line = ts+" : "+title+" : "+author+" : "+url
|
|
83
|
-
filename = pRequest.Found+".txt"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
self.PutLine(filename, line)
|
|
87
|
-
self.PutLine(filename, "")
|
|
88
|
-
self.PutLine(filename, text)
|
|
89
|
-
self.PutLine(filename, " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
|
|
90
|
-
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
def PutLine(self,filename,string):
|
|
94
|
-
try:
|
|
95
|
-
with open(filename, "a",encoding="utf-8") as outfile:
|
|
96
|
-
outfile.write(string)
|
|
97
|
-
except Exception as e:
|
|
98
|
-
raise e
|
|
99
|
-
|
|
100
|
-
class FileOperationWithIrisAdapter(BusinessOperation):
|
|
101
|
-
|
|
102
|
-
def get_adapter_type():
|
|
103
|
-
"""
|
|
104
|
-
Name of the registred Adapter
|
|
105
|
-
"""
|
|
106
|
-
return "EnsLib.File.OutboundAdapter"
|
|
107
|
-
|
|
108
|
-
def OnMessage(self, pRequest):
|
|
109
|
-
|
|
110
|
-
ts = title = author = url = text = ""
|
|
111
|
-
|
|
112
|
-
if (pRequest.Post != ""):
|
|
113
|
-
title = pRequest.Post.Title
|
|
114
|
-
author = pRequest.Post.Author
|
|
115
|
-
url = pRequest.Post.Url
|
|
116
|
-
text = pRequest.Post.Selftext
|
|
117
|
-
ts = iris.cls("%Library.PosixTime").LogicalToOdbc(iris.cls("%Library.PosixTime").UnixTimeToLogical(pRequest.Post.CreatedUTC))
|
|
118
|
-
|
|
119
|
-
line = ts+" : "+title+" : "+author+" : "+url
|
|
120
|
-
filename = pRequest.Found+".txt"
|
|
121
|
-
|
|
122
|
-
self.Adapter.PutLine(filename, line)
|
|
123
|
-
self.Adapter.PutLine(filename, "")
|
|
124
|
-
self.Adapter.PutLine(filename, text)
|
|
125
|
-
self.Adapter.PutLine(filename, " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
|
|
126
|
-
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
class MyOperation(BusinessOperation):
|
|
130
|
-
|
|
131
|
-
def OnMessage(self, request):
|
|
132
|
-
self.LOGINFO('hello')
|
|
133
|
-
return MyResponse(request.StringValue)
|
|
134
|
-
|
|
135
|
-
if __name__ == "__main__":
|
|
136
|
-
|
|
137
|
-
op = FileOperation()
|
|
138
|
-
from message import PostMessage,PostClass
|
|
139
|
-
msg = PostMessage(PostClass('foo','foo','foo','foo',1,'foo'),'bar','bar')
|
|
140
|
-
op.OnMessage(msg)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from grongier.pex import BusinessProcess
|
|
2
|
-
|
|
3
|
-
from message import PostMessage
|
|
4
|
-
|
|
5
|
-
class FilterPostRoutingRule(BusinessProcess):
|
|
6
|
-
|
|
7
|
-
def OnInit(self):
|
|
8
|
-
|
|
9
|
-
if not hasattr(self,'Target'):
|
|
10
|
-
self.Target = "Python.FileOperation"
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
def OnRequest(self, request: PostMessage):
|
|
15
|
-
if 'dog'.upper() in request.Post.Selftext.upper():
|
|
16
|
-
request.ToEmailAddress = 'dog@company.com'
|
|
17
|
-
request.Found = 'Dog'
|
|
18
|
-
if 'cat'.upper() in request.Post.Selftext.upper():
|
|
19
|
-
request.ToEmailAddress = 'cat@company.com'
|
|
20
|
-
request.Found = 'Cat'
|
|
21
|
-
return self.SendRequestSync(self.Target,request)
|