def get_hosts(self): if cherrypy.session.get("login_msg", None) == "AJAX not authorized": return '{"redirect": "/login"}' return API.get_hosts()