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

Class ServerModule

web/pgadmin/browser/server_groups/servers/__init__.py:153–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151
152
153class ServerModule(sg.ServerGroupPluginModule):
154 _NODE_TYPE = "server"
155 LABEL = gettext("Servers")
156
157 @property
158 def node_type(self):
159 return self._NODE_TYPE
160
161 @property
162 def script_load(self):
163 """
164 Load the module script for server, when any of the server-group node is
165 initialized.
166 """
167 return sg.ServerGroupModule.node_type
168
169 @staticmethod
170 def get_shared_server_properties(server, sharedserver):
171 """
172 Return shared server properties.
173
174 Overlays per-user SharedServer values onto the owner's Server
175 object so each non-owner sees their own customizations.
176
177 The server is expunged from the SQLAlchemy session before
178 mutation so that the owner's record is never dirtied.
179 :param server:
180 :param sharedserver:
181 :return: shared server (detached)
182 """
183 if sharedserver is None:
184 return server
185
186 # Detach from session so in-place mutations are never
187 # flushed back to the owner's Server row.
188 sess = object_session(server)
189 if sess is not None:
190 sess.expunge(server)
191
192 server.bgcolor = sharedserver.bgcolor
193 server.fgcolor = sharedserver.fgcolor
194 server.name = sharedserver.name
195 server.role = sharedserver.role
196 server.service = sharedserver.service
197 server.use_ssh_tunnel = sharedserver.use_ssh_tunnel
198 server.tunnel_host = sharedserver.tunnel_host
199 server.tunnel_port = sharedserver.tunnel_port
200 server.tunnel_authentication = sharedserver.tunnel_authentication
201 server.tunnel_username = sharedserver.tunnel_username
202 server.tunnel_password = sharedserver.tunnel_password
203 server.save_password = sharedserver.save_password
204 server.tunnel_identity_file = sharedserver.tunnel_identity_file
205 server.tunnel_prompt_password = sharedserver.tunnel_prompt_password
206
207 # Override per-user connection_params keys. Use the
208 # SharedServer value whenever it is present, regardless of
209 # whether the owner's Server has the same key.
210 s_conn = getattr(server, 'connection_params', None) \

Callers 1

__init__.pyFile · 0.85

Calls 1

gettextFunction · 0.85

Tested by

no test coverage detected