Exemple #1
0
    def get(self):
        user = users.get_current_user()
        logging.debug("BasicRootHandler #get")

        q = Service.all()
        q.order("name")
        services = q.fetch(100)
        
        p = Status.all()
        p.order("severity")
        
        past = get_past_days(5)

        services = q.fetch(100)
    
        for s in services:
            logging.info(s.last_six_days())

        
        td = {}
        td["services"] = services
        td["statuses"] = p.fetch(100)
        td["past"] = past
        td["default"] = Status.default()

        self.render(td, 'site/index.html')
Exemple #2
0
    def post(self, version, service_slug):
        logging.debug("EventsListHandler#post")
        
        if (self.valid_version(version)):
            status_slug = self.request.get("status", default_value=None)
            message = self.request.get("message", default_value=None)
            informational = self.request.get("informational", default_value=None)
            
            if message:
                service = Service.get_by_slug(service_slug)
                if service:
                    
                    if not status_slug:
                        event = service.current_event()
                        if event:
                            status = event.status
                        else:
                            status = Status.default()
                    else:
                        status = Status.get_by_slug(status_slug)

                    if status:
                        e = Event(status=status, service=service,
                                message=message)

                        e.informational = informational and informational == "true"

                        e.put()
                        self.json(e.rest(self.base_url(version)))
                    else:
                        self.error(404, "Status %s not found" % status_slug)
                else:
                    self.error(404, "Service %s not found" % service_slug)
            else:
                self.error(400, "Event message is required")
        else:
            self.error(404, "API Version %s not supported" % version)