Skip to content

Commit f00770c

Browse files
committed
feat: Move transport call() functionality to _call()
Instead of having transports override the base class's call method directly, instead it will call the _call method and subclassess should override it instead. This paves the way for adding consistent base functionality across transports.
1 parent 7650345 commit f00770c

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/itoolkit/transport/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ def call(self, tk):
3535
Returns:
3636
str: The XML returned from XMLSERVICE
3737
"""
38+
return self._call(tk)
39+
40+
def _call(self, tk):
41+
"""Called by :py:func:`call`. This should be overridden by subclasses
42+
to the call function instead of overriding :py:func:`call` directly.
43+
"""
3844
raise NotImplementedError

src/itoolkit/transport/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self, conn, **kwargs):
6767
('proc', 'procedure')
6868
])
6969

70-
def call(self, tk):
70+
def _call(self, tk):
7171
cursor = self.conn.cursor()
7272

7373
parms = (self.ipc, self.ctl, tk.xml_in())

src/itoolkit/transport/direct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DirectTransport(XmlServiceTransport):
2727
def __init__(self, **kwargs):
2828
super(DirectTransport, self).__init__(**kwargs)
2929

30-
def call(self, tk):
30+
def _call(self, tk):
3131
try:
3232
data = _direct.xmlservice(tk.xml_in(), self.ctl, self.ipc)
3333

src/itoolkit/transport/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, url, user, password, database='*LOCAL', **kwargs):
4848

4949
OUT_SIZE = 16 * 1000 * 1000
5050

51-
def call(self, tk):
51+
def _call(self, tk):
5252
data = urlencode({
5353
'db2': self.db,
5454
'uid': self.uid,

src/itoolkit/transport/ssh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, sshclient=None, **kwargs):
6464

6565
self.conn = sshclient
6666

67-
def call(self, tk):
67+
def _call(self, tk):
6868
"""Call xmlservice with accumulated input XML.
6969
7070
Args:

0 commit comments

Comments
 (0)