Пример #1
0
    def GET(self, code):
        errors = []
        user, domain = models.user_domain_from_code(code)
        user.unsubscribe(domain)

        self.page["domain,"] = domain
        self.page["errors"] = errors

        return self.render()
Пример #2
0
    def GET(self, code):      
        domain_name = None

        domain = None
        try:
            user, domain = models.user_domain_from_code(code)
            user.confirm_subscription(domain)

            # how to unsubscribe
            longest_downtime, average_downtime = domain.longest_average_downtime_in_past_30_days
            mail.send(
                user.email_address,
                "How to Unsubscribe",
                "email/subscription_complete.tmpl",
                {
                    "domain_name": domain.name,
                    "to_address": user.email_address,
                    "from_address": config.mail['from_address'],
                    "unsubscribe_url": domain.get_unsubscribe_url(user),
                    "site_url": site_url,
                    "num_of_outages": domain.num_outages_in_past_30_days,
                    "longest_outage": "%0.1f" % longest_downtime,
                    "average_downtime": "%0.1f" % average_downtime,
                    "diff": domain.num_outages_in_past_30_days_difference_from_average,
                    "month": utils.past_30_days_text(),
                },
                images=[
                    ['snapshot', domain.get_thumbnail_url(confirm=True)]
                ]
            )
                
            self.page["errors"] = [] 
        except:
            self.page["errors"] = [True]

        self.page["domain,"] = domain
        self.page["breadcrumbs"] = [
            urls["home"],
            urls["signup"],
        ]
    
        return self.render()