예제 #1
0
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)}
예제 #2
0
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)}
예제 #3
0
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)}
예제 #4
0
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)}
예제 #5
0
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)
    }
예제 #6
0
파일: helpers.py 프로젝트: lauraxt/zamboni
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),
    }
예제 #7
0
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])
예제 #8
0
 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))
예제 #9
0
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])
예제 #10
0
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])
예제 #11
0
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
예제 #12
0
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
예제 #13
0
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
예제 #14
0
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])
예제 #15
0
파일: helpers.py 프로젝트: exezaid/zamboni
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)}
예제 #16
0
def test_datetime_unicode():
    fmt = u"%Y 年 %m 月 %e 日"
    helpers.datetime(datetime.now(), fmt)
예제 #17
0
파일: feeds.py 프로젝트: AALEKH/zamboni
 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))
예제 #18
0
파일: helpers.py 프로젝트: dupuy/scrumbugz
def now(fmt=None):
    return helpers.datetime(django_now(), fmt)
예제 #19
0
def now(fmt=None):
    return helpers.datetime(datetime.now(), fmt)
예제 #20
0
파일: helpers.py 프로젝트: zuzelvp/zamboni
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)}
예제 #21
0
def now(fmt=None):
    return helpers.datetime(django_now(), fmt)
예제 #22
0
def test_datetime_unicode():
    fmt = u"%Y 年 %m 月 %e 日"
    helpers.datetime(datetime.now(), fmt)