Ejemplo n.º 1
0
    def post(self):
        from activation import calculate_activation_code
        
        invoice_key = self.get_argument('invoice_key')
        invoice = db.get(db.Key(invoice_key))
        
        activation_credentials_list = []
        for order in invoice.orders:
            for credentials in order.activation_credentials:
                credentials.activation_code = calculate_activation_code(
                    machine_id=credentials.machine_id,
                    serial_number=credentials.serial_number
                )
                activation_credentials_list.append(credentials)
        db.put(activation_credentials_list)
        customer = invoice.customer
        content = self.render_string('email/activation_code.txt', 
            activation_credentials_list=activation_credentials_list,
            customer=customer)

        send_mail_once(cache_key=invoice_key + str(customer.key()),
            worker_url=WORKER_MAIL_ACTIVATION_URL,
            body=content,
            to=customer.email,
            subject='%s Your activation codes' % configuration.MAIL_SUBJECT_PREFIX)
Ejemplo n.º 2
0
 def post(self):
     profile_key = self.get_argument("profile_key")
     profile = db.get(db.Key(profile_key))
     body = self.render_string("email/activate-account.txt", profile=profile)
     send_mail_once(
         cache_key="@" + self.__class__.__name__ + unicode(self.request.arguments),
         body=body,
         to=profile.email_addresses_list,
         subject="Your account has been activated.",
     )