<commit_before># -*- coding: utf-8 -*-

"""
byceps.blueprints.user.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2014 <NAME>
"""

from datetime import datetime

from flask import abort, current_app, g, request, session, url_for

from ...config import get_site_mode
from ...database import db
from ...mail import mail
from ...util.framework import create_blueprint, flash_error, flash_notice, \
    flash_success
from ...util.image import create_thumbnail, Dimensions, \
    guess_type as guess_image_type, read_dimensions
from ...util.templating import templated
from ...util import upload
from ...util.views import redirect_to, respond_no_content

from ..authorization.models import Role
from ..newsletter.models import Subscription as NewsletterSubscription, \
    SubscriptionState as NewsletterSubscriptionState
from ..terms.models import Consent, ConsentContext
from ..ticket.service import find_current_party_ticket_for_user

from .forms import AvatarImageUpdateForm, DetailsForm, LoginForm, \
    RequestConfirmationEmailForm, RequestPasswordResetForm, \
    ResetPasswordForm, UpdatePasswordForm, UserCreateForm
from .models import User, VerificationToken, VerificationTokenPurpose


MAXIMUM_AVATAR_IMAGE_DIMENSIONS = Dimensions(110, 150)


blueprint = create_blueprint('user', __name__)


@blueprint.before_app_request
def before_request():
    g.current_user = UserSession.get_user()


@blueprint.route('/<id>')
@templated
def view(id):
    """Show a user's profile."""
    user = find_user_by_id(id)
    current_party_ticket = find_current_party_ticket_for_user(g.current_user)
    return {
        'user': user,
        'current_party_ticket': current_party_ticket,
    }


@blueprint.route('/create')
@templated
def create_form(errorneous_form=None):
    """Show a form to create a user."""
    form = errorneous_form if errorneous_form else UserCreateForm()
    return {'form': form}


@blueprint.route('/', methods=['POST'])
def create():<commit_msg>Fixed display of the current party ticket on a user profile.<commit_after># -*- coding: utf-8 -*-

"""
byceps.blueprints.user.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2014 <NAME>
"""

from datetime import datetime

from flask import abort, current_app, g, request, session, url_for

from ...config import get_site_mode
from ...database import db
from ...mail import mail
from ...util.framework import create_blueprint, flash_error, flash_notice, \
    flash_success
from ...util.image import create_thumbnail, Dimensions, \
    guess_type as guess_image_type, read_dimensions
from ...util.templating import templated
from ...util import upload
from ...util.views import redirect_to, respond_no_content

from ..authorization.models import Role
from ..newsletter.models import Subscription as NewsletterSubscription, \
    SubscriptionState as NewsletterSubscriptionState
from ..terms.models import Consent, ConsentContext
from ..ticket.service import find_current_party_ticket_for_user

from .forms import AvatarImageUpdateForm, DetailsForm, LoginForm, \
    RequestConfirmationEmailForm, RequestPasswordResetForm, \
    ResetPasswordForm, UpdatePasswordForm, UserCreateForm
from .models import User, VerificationToken, VerificationTokenPurpose


MAXIMUM_AVATAR_IMAGE_DIMENSIONS = Dimensions(110, 150)


blueprint = create_blueprint('user', __name__)


@blueprint.before_app_request
def before_request():
    g.current_user = UserSession.get_user()


@blueprint.route('/<id>')
@templated
def view(id):
    """Show a user's profile."""
    user = find_user_by_id(id)
    current_party_ticket = find_current_party_ticket_for_user(user)
    return {
        'user': user,
        'current_party_ticket': current_party_ticket,
    }


@blueprint.route('/create')
@templated
def create_form(errorneous_form=None):
    """Show a form to create a user."""
    form = errorneous_form if errorneous_form else UserCreateForm()
    return {'form': form}


@blueprint.route('/', methods=['POST'])
def create():
{'fraction_non_alphanumeric': 0.11303692539562923, 'fraction_numerical': 0.007535795026375283, 'mean_word_length': 4.9700149925037485, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1772922', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1162, 'n_words': 313}