Exemplo n.º 1
0
    def get(self):
        user = users.get_current_user()
        system_param = self.request.get('system')
        if not system_param:
            template = JINJA_ENVIRONMENT.get_template(
                "templates/not_found.html")
            template_values = {
                "user": user,
                "users": users,
                "not_found_msg": "Please select a system"
            }
            self.response.write(template.render(template_values))
            return

        system = System.get_by_id(system_param)
        if system is None:
            template = JINJA_ENVIRONMENT.get_template(
                "templates/not_found.html")
            template_values = {
                "user": user,
                "users": users,
                "not_found_msg":
                "The system #{0} not exists".format(system_param)
            }
            self.response.write(template.render(template_values))
            return

        #logs = Log.query(ancestor = system.key).fetch()

        logs = []

        template_values = {
            "system": system,
            "logs": logs,
            "token": channel.create_channel(system.key.id()),
            "user": user,
            "users": users
        }
        template = JINJA_ENVIRONMENT.get_template("templates/logs.html")
        self.response.write(template.render(template_values))
        return