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

Function wrap

web/pgadmin/tools/grant_wizard/__init__.py:89–114  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

87
88 @wraps(f)
89 def wrap(*args, **kwargs):
90 # Here args[0] will hold self & kwargs will hold sid,did
91
92 server_info.clear()
93 server_info['manager'] = get_driver(PG_DEFAULT_DRIVER)\
94 .connection_manager(kwargs['sid'])
95 server_info['conn'] = server_info['manager'].connection(
96 did=kwargs['did']
97 )
98 # If DB not connected then return error to browser
99 if not server_info['conn'].connected():
100 return precondition_required(
101 gettext("Connection to the server has been lost.")
102 )
103
104 # Set template path for sql scripts
105 server_info['server_type'] = server_info['manager'].server_type
106 server_info['version'] = server_info['manager'].version
107 if server_info['server_type'] == 'pg':
108 server_info['template_path'] = 'grant_wizard/pg/#{0}#'.format(
109 server_info['version'])
110 elif server_info['server_type'] == 'ppas':
111 server_info['template_path'] = 'grant_wizard/ppas/#{0}#'.format(
112 server_info['version'])
113
114 return f(*args, **kwargs)
115
116 return wrap
117

Callers

nothing calls this directly

Calls 7

get_driverFunction · 0.90
precondition_requiredFunction · 0.90
gettextFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
clearMethod · 0.45
connectedMethod · 0.45

Tested by

no test coverage detected