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

Function store

web/pgadmin/settings/__init__.py:123–147  ·  view source on GitHub ↗

Store a configuration setting, or if this is a POST request and a count value is present, store multiple settings at once.

(setting=None, value=None)

Source from the content-addressed store, hash-verified

121@blueprint.route("/store/<setting>/<value>", methods=['PUT'], endpoint='store')
122@pga_login_required
123def store(setting=None, value=None):
124 """Store a configuration setting, or if this is a POST request and a
125 count value is present, store multiple settings at once."""
126 success = 1
127 errormsg = ''
128
129 try:
130 data = request.form if request.form else json.loads(
131 request.data.decode('utf-8'))
132 if request.method == 'POST':
133 if 'count' in request.form:
134 for x in range(int(data['count'])):
135 store_setting(data['setting%d' % (
136 x + 1)], data['value%d' % (x + 1)])
137 else:
138 store_setting(data['setting'], data['value'])
139 else:
140 store_setting(setting, value)
141 except Exception as e:
142 success = 0
143 errormsg = str(e)
144
145 return make_json_response(success=success,
146 errormsg=errormsg,
147 info=gettext("Setting stored"))
148
149
150@blueprint.route("/layout", methods=['DELETE'], endpoint='reset_layout')

Callers

nothing calls this directly

Calls 4

make_json_responseFunction · 0.90
store_settingFunction · 0.85
gettextFunction · 0.85
decodeMethod · 0.80

Tested by

no test coverage detected