MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / IEMessage

Class IEMessage

web/pgadmin/tools/import_export/__init__.py:57–150  ·  view source on GitHub ↗

IEMessage(IProcessDesc) Defines the message shown for the import/export operation.

Source from the content-addressed store, hash-verified

55
56
57class IEMessage(IProcessDesc):
58 """
59 IEMessage(IProcessDesc)
60
61 Defines the message shown for the import/export operation.
62 """
63
64 def __init__(self, *_args, **io_params):
65 self.sid = io_params['sid']
66 self.schema = io_params['schema']
67 self.table = io_params['table']
68 self.database = io_params['database']
69 self._cmd = ''
70 self.is_import = io_params['is_import']
71 self.bfile = io_params['filename']
72
73 if io_params['storage']:
74 io_params['storage'] = io_params['storage'].replace('\\', '/')
75
76 def cmd_arg(x):
77 if x:
78 x = x.replace('\\', '\\\\')
79 x = x.replace('"', '\\"')
80 x = x.replace('""', '\\"')
81
82 return ' "' + x + '"'
83 return ''
84
85 replace_next = False
86 for arg in _args:
87 if arg and len(arg) >= 2 and arg.startswith('--'):
88 if arg == '--command':
89 replace_next = True
90 self._cmd += ' ' + arg
91 elif replace_next:
92 arg = cmd_arg(arg)
93 if io_params['storage'] is not None:
94 arg = arg.replace(io_params['storage'], '<STORAGE_DIR>')
95 self._cmd += ' "' + arg + '"'
96 else:
97 self._cmd += cmd_arg(arg)
98
99 def get_server_name(self):
100 # Fetch the server details like hostname, port, roles etc
101 s = get_server(self.sid)
102
103 if s is None:
104 return _("Not available")
105 host_port_str = ''
106 if s.host:
107 host_port_str = '({0}:{1})'.format(
108 s.host, s.port) if s.port else '{0}'.format(s.host)
109
110 return "{0} {1}".format(s.name, host_port_str)
111
112 @property
113 def message(self):
114 # Fetch the server details like hostname, port, roles etc

Callers 3

runTestMethod · 0.90
runTestMethod · 0.90
create_import_export_jobFunction · 0.85

Calls

no outgoing calls

Tested by 2

runTestMethod · 0.72
runTestMethod · 0.72