def file_status_message(file): choices = File.STATUS_CHOICES return {'fileid': file.id, 'platform': file.get_platform_display(), 'created': datetime(file.created), 'status': choices[file.status], 'actions': amo.LOG_REVIEW_EMAIL_USER, 'status_date': datetime(file.datestatuschanged)}
def file_status_message(file, addon, file_history=False): choices = status_choices(addon) return {'fileid': file.id, 'platform': file.get_platform_display(), 'created': datetime(file.created), 'status': choices[file.status], 'file_history': file_history, 'actions': amo.LOG_REVIEW_EMAIL_USER, 'status_date': datetime(file.datestatuschanged)}
def file_status_message(file, addon, file_history=False): choices = status_choices(addon) return {'fileid': file.id, 'platform': file.amo_platform.name, 'created': datetime(file.created), 'status': choices[file.status], 'file_history': file_history, 'actions': amo.LOG_REVIEW_EMAIL_USER, 'status_date': datetime(file.datestatuschanged)}
def file_status_message(file, addon): choices = status_choices(addon) return { 'fileid': file.id, 'platform': file.amo_platform.name, 'created': datetime(file.created), 'status': choices[file.status], 'status_date': datetime(file.datestatuschanged) }
def file_status_message(file, addon, file_history=False): choices = status_choices(addon) return { "fileid": file.id, "platform": file.amo_platform.name, "created": datetime(file.created), "status": choices[file.status], "file_history": file_history, "actions": amo.LOG_REVIEW_EMAIL_USER, "status_date": datetime(file.datestatuschanged), }
def send_purchase_receipt(contrib_id, **kw): """ Sends an email to the purchaser of the app. """ contrib = Contribution.objects.get(pk=contrib_id) with contrib.user.activate_lang(): # L10n: {0} is the app name. subject = _('Receipt for {0}') % contrib.addon.name data = { 'app_name': contrib.addon.name, 'authors': ', '.join([ author.display_name for author in contrib.addon.authors.all() ]), 'date': datetime(contrib.created.date()), 'purchases': absolutify(reverse('account.purchases')), 'support_url': contrib.addon.support_url, 'terms_of_service_url': absolutify(reverse('site.terms')), 'transaction_id': contrib.uuid } log.info('Sending email about purchase: %s' % contrib_id) send_mail_jinja(subject, 'purchase/receipt.txt', data, recipient_list=[contrib.user.email])
def item_title(self, version): """Title for particular version (<item><title>)""" # L10n: This is the Title for this Version of the Addon return u'{name} {version} - {created}'.format(name=self.addon.name, version=version.version, created=datetime( version.created))
def send_purchase_receipt(contrib_id, **kw): """ Sends an email to the purchaser of the app. """ contrib = Contribution.objects.get(pk=contrib_id) with contrib.user.activate_lang(): addon = contrib.addon version = addon.current_version or addon.latest_version # L10n: {0} is the app name. subject = _('Receipt for {0}').format(contrib.addon.name) data = { 'app_name': addon.name, 'developer_name': version.developer_name if version else '', 'price': contrib.get_amount_locale(get_locale_from_lang( contrib.source_locale)), 'date': datetime(contrib.created.date()), 'purchaser_email': contrib.user.email, #'purchaser_phone': '', # TODO: See bug 894614. #'purchaser_last_four': '', 'transaction_id': contrib.uuid, 'purchases_url': absolutify('/purchases'), 'support_url': addon.support_url, 'terms_of_service_url': absolutify(reverse('site.terms')), } log.info('Sending email about purchase: %s' % contrib_id) text_template = 'purchase/receipt.ltxt' html_template = 'purchase/receipt.html' send_html_mail_jinja(subject, html_template, text_template, data, recipient_list=[contrib.user.email])
def send_purchase_receipt(contrib_id, **kw): """ Sends an email to the purchaser of the app. """ contrib = Contribution.objects.get(pk=contrib_id) with contrib.user.activate_lang(): addon = contrib.addon version = addon.current_version or addon.latest_version # L10n: {0} is the app name. subject = _('Receipt for {0}').format(contrib.addon.name) data = { 'app_name': addon.name, 'developer_name': version.developer_name if version else '', 'price': contrib.get_amount_locale(get_locale_from_lang( contrib.source_locale)), 'date': datetime(contrib.created.date()), 'purchaser_email': contrib.user.email, #'purchaser_phone': '', # TODO: See bug 894614. #'purchaser_last_four': '', 'transaction_id': contrib.uuid, 'purchases_url': absolutify('/purchases'), 'support_url': addon.support_url, 'terms_of_service_url': absolutify('/terms-of-use'), } log.info('Sending email about purchase: %s' % contrib_id) text_template = 'purchase/receipt.ltxt' html_template = 'purchase/receipt.html' send_html_mail_jinja(subject, html_template, text_template, data, recipient_list=[contrib.user.email])
def agreement(request, id): account = get_object_or_404(PaymentAccount, pk=id, user=request.user) # It's a shame we have to do another get to find this out. package = client.api.bango.package(account.uri).get_object_or_404() if request.method == "POST": # Set the agreement. account.update(agreed_tos=True) return client.api.bango.sbi.post(data={"seller_bango": package["resource_uri"]}) res = client.api.bango.sbi.agreement.get_object(data={"seller_bango": package["resource_uri"]}) res["valid"] = helpers.datetime(datetime.strptime(res["valid"], "%Y-%m-%dT%H:%M:%S")) return res
def agreement(request, id): account = get_object_or_404(PaymentAccount, pk=id, user=request.user) # It's a shame we have to do another get to find this out. package = client.api.bango.package(account.uri).get_object_or_404() if request.method == 'POST': # Set the agreement. account.update(agreed_tos=True) return (client.api.bango.sbi.post( data={'seller_bango': package['resource_uri']})) res = (client.api.bango.sbi.agreement .get_object(data={'seller_bango': package['resource_uri']})) res['valid'] = helpers.datetime( datetime.strptime(res['valid'], '%Y-%m-%dT%H:%M:%S')) return res
def agreement(request, id): account = get_object_or_404(PaymentAccount, pk=id, user=request.user) # It's a shame we have to do another get to find this out. package = client.api.bango.package(account.uri).get_object_or_404() if request.method == 'POST': # Set the agreement. account.update(agreed_tos=True) return (client.api.bango.sbi.post( data={'seller_bango': package['resource_uri']})) res = (client.api.bango.sbi.agreement.get_object( data={'seller_bango': package['resource_uri']})) res['valid'] = helpers.datetime( datetime.strptime(res['valid'], '%Y-%m-%dT%H:%M:%S')) return res
def send_purchase_receipt(contrib_id, **kw): """ Sends an email to the purchaser of the app. """ contrib = Contribution.objects.get(pk=contrib_id) with contrib.user.activate_lang(): # L10n: {0} is the app name. subject = _('Receipt for {0}') % contrib.addon.name data = { 'app_name': contrib.addon.name, 'authors': ', '.join([author.display_name for author in contrib.addon.authors.all()]), 'date': datetime(contrib.created.date()), 'purchases': absolutify('/purchases'), 'support_url': contrib.addon.support_url, 'terms_of_service_url': absolutify(reverse('site.terms')), 'transaction_id': contrib.uuid } log.info('Sending email about purchase: %s' % contrib_id) send_mail_jinja(subject, 'purchase/receipt.txt', data, recipient_list=[contrib.user.email])
def file_status_message(file): return {'fileid': file.id, 'platform': file.amo_platform.name, 'created': datetime(file.created), 'status': amo.STATUS_CHOICES[file.status], 'status_date': datetime(file.datestatuschanged)}
def test_datetime_unicode(): fmt = u"%Y 年 %m 月 %e 日" helpers.datetime(datetime.now(), fmt)
def item_title(self, version): """Title for particular version (<item><title>)""" # L10n: This is the Title for this Version of the Addon return u'{name} {version} - {created}'.format( name=self.addon.name, version=version.version, created=datetime(version.created))
def now(fmt=None): return helpers.datetime(django_now(), fmt)
def now(fmt=None): return helpers.datetime(datetime.now(), fmt)
def file_status_message(file, addon): choices = status_choices(addon) return {'fileid': file.id, 'platform': file.amo_platform.name, 'created': datetime(file.created), 'status': choices[file.status], 'status_date': datetime(file.datestatuschanged)}