MCPcopy Index your code
hub / github.com/bugy/script-server / get

Method get

src/web/server.py:226–243  ·  view source on GitHub ↗
(self, user, script_name)

Source from the content-addressed store, hash-verified

224 @requires_admin_rights
225 @inject_user
226 def get(self, user, script_name):
227 try:
228 loaded_script = self.application.config_service.load_script_code(script_name, user)
229 except ConfigNotAllowedException:
230 LOGGER.warning('Admin access to the script "' + script_name + '" is denied for ' + user.get_audit_name())
231 respond_error(self, 403, 'Access to the script is denied')
232 return
233 except InvalidFileException as e:
234 LOGGER.warning('Failed to load script code for script ' + script_name, exc_info=True)
235 respond_error(self, 422, str(e))
236 return
237 except InvalidAccessException as e:
238 raise tornado.web.HTTPError(403, reason=str(e))
239
240 if loaded_script is None:
241 raise tornado.web.HTTPError(404, str('Failed to find config for name: ' + script_name))
242
243 self.write(json.dumps(loaded_script))
244
245
246class ScriptStop(BaseRequestHandler):

Callers

nothing calls this directly

Calls 4

respond_errorFunction · 0.90
load_script_codeMethod · 0.80
get_audit_nameMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected