<commit_before>import traceback

import balanced
from aspen import json, log, Response
from gittip import billing
from gittip.networks import github

# ========================================================================== ^L

if not user.ANON:
    balanced_account_uri = user.balanced_account_uri
    stripe_customer_id = user.stripe_customer_id

    status = "missing"
    if stripe_customer_id or balanced_account_uri:
        working = not bool(user.last_bill_result)
        status = "working" if working else "failing"

    if balanced_account_uri:
        try:
            customer = billing.BalancedAccount(balanced_account_uri)
        except:  # balanced is unavailable (or balanced_account_uri is bad?)
            log(traceback.format_exc())
            payments_down = True
        else:
            assert balanced_account_uri == customer['id']
            payments_down = False
    else:
        try:
            customer = billing.StripeCustomer(stripe_customer_id)
        except:  # stripe is unavailable (or strip_customer_id is bad?)
            log(traceback.format_exc())
            payments_down = True
        else:
            assert stripe_customer_id == customer['id']
            payments_down = False

    username = user.id
# ========================================================================== ^L
{% extends templates/base.html %}


{% block body %}
{% if user.ANON %}
<div id="their-voice">
<h2 class="first">Credit Card</h2>

<p>Sign in <a href="{{ github.oauth_url(website, u'opt-in', u'/credit-card.html') }}">with
GitHub</a>, and then you&rsquo;ll be able to add or change your credit card.
Thanks! :-)</p>

</div>

{% else %}
hdif
{{ user.statement }}
<script><commit_msg>WTF? Where did this come from? (#172)<commit_after>import traceback

import balanced
from aspen import json, log, Response
from gittip import billing
from gittip.networks import github

# ========================================================================== ^L

if not user.ANON:
    balanced_account_uri = user.balanced_account_uri
    stripe_customer_id = user.stripe_customer_id

    status = "missing"
    if stripe_customer_id or balanced_account_uri:
        working = not bool(user.last_bill_result)
        status = "working" if working else "failing"

    if balanced_account_uri:
        try:
            customer = billing.BalancedAccount(balanced_account_uri)
        except:  # balanced is unavailable (or balanced_account_uri is bad?)
            log(traceback.format_exc())
            payments_down = True
        else:
            assert balanced_account_uri == customer['id']
            payments_down = False
    else:
        try:
            customer = billing.StripeCustomer(stripe_customer_id)
        except:  # stripe is unavailable (or strip_customer_id is bad?)
            log(traceback.format_exc())
            payments_down = True
        else:
            assert stripe_customer_id == customer['id']
            payments_down = False

    username = user.id
# ========================================================================== ^L
{% extends templates/base.html %}


{% block body %}
{% if user.ANON %}
<div id="their-voice">
<h2 class="first">Credit Card</h2>

<p>Sign in <a href="{{ github.oauth_url(website, u'opt-in', u'/credit-card.html') }}">with
GitHub</a>, and then you&rsquo;ll be able to add or change your credit card.
Thanks! :-)</p>

</div>

{% else %}
<script>
{'fraction_non_alphanumeric': 0.18033740546829552, 'fraction_numerical': 0.002036067481093659, 'mean_word_length': 3.2248157248157248, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1031180', 'n_tokens_mistral': 1027, 'n_tokens_neox': 942, 'n_words': 255}