Esempio n. 1
0
    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()
Esempio n. 2
0
    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()
Esempio n. 3
0
    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()
Esempio n. 4
0
    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()