def get(self, app_name, unique_hash):
        import cgi

        app, app_name = self._global(app_name)

        exception_group = LoggingService.get_exception_group(unique_hash)

        lh_memberships = LighthouseService.get_project_memberships(
                                    app['lighthouse_project_id']
                         )

        members = []
        for member in lh_memberships:
            members.append(
                    {
                        'name': member['membership']['user']['name'],
                        'id': member['membership']['user']['id']
                    }
            )

        self._data['exception_group'] = exception_group
        self._data['unique_hash'] = unique_hash
        self._data['htmlTitle'] = 'OnErrorLog - Create Lighthouse Ticket'
        self._data['section_title'] = '%s : %s' % (app['application'], self._data['exception_group']['message'][0:60])
        self._data['cgi'] = cgi
        self._data['members'] = members

        self.write(self.render_view('../Views/lighthouse.html', self._data))
    def post(self, app_name, unique_hash):
        lighthouse_title = self.get_argument('lighthouse_title', None)
        lighthouse_member = self.get_argument('lighthouse_member', None)
        lighthouse_body = self.get_argument('lighthouse_body', None)

        app, app_name = self._global(app_name)

        ticket_url = LighthouseService.create_ticket(app['lighthouse_project_id'], lighthouse_title, lighthouse_body, user_id=lighthouse_member)

        exception_group = LoggingService.get_exception_group(unique_hash)

        exception_groups = Database.Instance().exception_groups()
        exception_group['lighthouse_url'] = ticket_url
        exception_groups.save(exception_group)

        self.redirect('/%s/details/%s' % (app_name, unique_hash))
    def get(self, app_name, unique_hash):
        import cgi

        app, app_name = self._global(app_name)

        exception_group = LoggingService.get_exception_group(unique_hash)

        lh_memberships = LighthouseService.get_project_memberships(app["lighthouse_project_id"])

        members = []
        for member in lh_memberships:
            members.append({"name": member["membership"]["user"]["name"], "id": member["membership"]["user"]["id"]})

        self._data["exception_group"] = exception_group
        self._data["unique_hash"] = unique_hash
        self._data["htmlTitle"] = "OnErrorLog - Create Lighthouse Ticket"
        self._data["section_title"] = "%s : %s" % (app["application"], self._data["exception_group"]["message"][0:60])
        self._data["cgi"] = cgi
        self._data["members"] = members

        self.write(self.render_view("../Views/lighthouse.html", self._data))