def GET(self): params = web.input() if not params.id.strip().isdigit(): raise web.internalerror("Parameter type error.") host = Host.get(params.id.strip()) vuls = Vul.where(host_id=host.id).gets("id") for vul in vuls: vul.remove() comments = Comment.where(host_id=host.id).gets("id") for comment in comments: comment.remove() host.remove() return jsonSuccess()
def GET(self): params = web.input() if not params.id.strip().isdigit(): raise web.internalerror("Parameter type error.") host = Host.get(params.id.strip()) vuls = Vul.where(host_id=host.id).gets("id") for vul in vuls: vul.remove() comments = Comment.where(host_id=host.id).gets("id") for comment in comments: comment.remove() host.remove() return jsonSuccess()
def GET(self): web.header('Content-Type', 'application/json') params = web.input() try: hid = str(int(params.id)) except AttributeError as error: RTD.log.error(error) raise web.internalerror(error) try: host = Host.get(hid) host.tmp = 0 host.save(update=True) except (KeyError, AttributeError, FieldError, ModelError, DBError) as error: RTD.log.error(error) raise web.internalerror(error) return jsonSuccess()
def GET(self): web.header('Content-Type', 'application/json') params = web.input() try: hid = str(int(params.id)) except AttributeError as error: RTD.log.error(error) raise web.internalerror(error) try: host = Host.get(hid) host.tmp = 0 host.save(update=True) except (KeyError, AttributeError, FieldError, ModelError, DBError) as error: RTD.log.error(error) raise web.internalerror(error) return jsonSuccess()