~homeworkprod/byceps

ef40cc23e0bcbb4be5c5831a96c06029646d2530 — Jochen Kupperschmidt 1 year, 2 months ago 7a6be27
Move user blueprint into `common` subpackage
28 files changed, 80 insertions(+), 80 deletions(-)

M byceps/application.py
M byceps/blueprints/admin/user/forms.py
M byceps/blueprints/authentication/views.py
R byceps/blueprints/{user/__init__.py => common/user/__init__.py}
R byceps/blueprints/{user/avatar/__init__.py => common/user/avatar/__init__.py}
R byceps/blueprints/{user/avatar/forms.py => common/user/avatar/forms.py}
R byceps/blueprints/{user/avatar/templates/user/avatar/update_form.html => common/user/avatar/templates/common/user/avatar/update_form.html}
R byceps/blueprints/{user/avatar/templates/macros/user_avatar.html => common/user/avatar/templates/macros/user_avatar.html}
R byceps/blueprints/{user/avatar/views.py => common/user/avatar/views.py}
R byceps/blueprints/{user/creation/__init__.py => common/user/creation/__init__.py}
R byceps/blueprints/{user/creation/forms.py => common/user/creation/forms.py}
R byceps/blueprints/{user/creation/templates/user/creation/create_form.html => common/user/creation/templates/common/user/creation/create_form.html}
R byceps/blueprints/{user/creation/views.py => common/user/creation/views.py}
R byceps/blueprints/{user/current/__init__.py => common/user/current/__init__.py}
R byceps/blueprints/{user/current/forms.py => common/user/current/forms.py}
R byceps/blueprints/{user/current/templates/user/current/_account.html => common/user/current/templates/common/user/current/_account.html}
R byceps/blueprints/{user/current/templates/user/current/_details_personal.html => common/user/current/templates/common/user/current/_details_personal.html}
R byceps/blueprints/{user/current/templates/user/current/_newsletter.html => common/user/current/templates/common/user/current/_newsletter.html}
R byceps/blueprints/{user/current/templates/user/current/change_screen_name_form.html => common/user/current/templates/common/user/current/change_screen_name_form.html}
R byceps/blueprints/{user/current/templates/user/current/details_update_form.html => common/user/current/templates/common/user/current/details_update_form.html}
R byceps/blueprints/{user/current/templates/user/current/view.html => common/user/current/templates/common/user/current/view.html}
R byceps/blueprints/{user/current/views.py => common/user/current/views.py}
R byceps/blueprints/{user/email_address/__init__.py => common/user/email_address/__init__.py}
R byceps/blueprints/{user/email_address/forms.py => common/user/email_address/forms.py}
R byceps/blueprints/{user/email_address/templates/user/email_address/request_confirmation_email_form.html => common/user/email_address/templates/common/user/email_address/request_confirmation_email_form.html}
R byceps/blueprints/{user/email_address/views.py => common/user/email_address/views.py}
R byceps/blueprints/{user/templates/macros/user.html => common/user/templates/macros/user.html}
R byceps/blueprints/{user/views.py => common/user/views.py}
M byceps/application.py => byceps/application.py +5 -5
@@ 101,11 101,11 @@ def _get_blueprints_common() -> Iterator[BlueprintReg]:
        ('authentication',              '/authentication'           ),
        ('authorization',               None                        ),
        ('core',                        '/core'                     ),
        ('user',                        None                        ),
        ('user.avatar',                 '/users'                    ),
        ('user.creation',               '/users'                    ),
        ('user.current',                '/users'                    ),
        ('user.email_address',          '/users/email_address'      ),
        ('common.user',                 None                        ),
        ('common.user.avatar',          '/users'                    ),
        ('common.user.creation',        '/users'                    ),
        ('common.user.current',         '/users'                    ),
        ('common.user.email_address',   '/users/email_address'      ),
    ]



M byceps/blueprints/admin/user/forms.py => byceps/blueprints/admin/user/forms.py +1 -1
@@ 13,7 13,7 @@ from ....services.site import service as site_service
from ....services.user import screen_name_validator
from ....util.l10n import LocalizedForm

from ...user.creation.forms import ScreenNameValidator
from ...common.user.creation.forms import ScreenNameValidator


MINIMUM_PASSWORD_LENGTH = 10

M byceps/blueprints/authentication/views.py => byceps/blueprints/authentication/views.py +1 -1
@@ 33,7 33,7 @@ from ...util.framework.templating import templated
from ...util.views import redirect_to, respond_no_content

from ..admin.core.authorization import AdminPermission
from ..user.creation.views import _find_privacy_policy_consent_subject_id
from ..common.user.creation.views import _find_privacy_policy_consent_subject_id

from .forms import (
    LoginForm,

R byceps/blueprints/user/__init__.py => byceps/blueprints/common/user/__init__.py +0 -0
R byceps/blueprints/user/avatar/__init__.py => byceps/blueprints/common/user/avatar/__init__.py +0 -0
R byceps/blueprints/user/avatar/forms.py => byceps/blueprints/common/user/avatar/forms.py +3 -3
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.avatar.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.avatar.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 9,7 9,7 @@ byceps.blueprints.user.avatar.forms
from wtforms import FileField
from wtforms.validators import InputRequired

from ....util.l10n import LocalizedForm
from .....util.l10n import LocalizedForm


class UpdateForm(LocalizedForm):

R byceps/blueprints/user/avatar/templates/user/avatar/update_form.html => byceps/blueprints/common/user/avatar/templates/common/user/avatar/update_form.html +0 -0
R byceps/blueprints/user/avatar/templates/macros/user_avatar.html => byceps/blueprints/common/user/avatar/templates/macros/user_avatar.html +0 -0
R byceps/blueprints/user/avatar/views.py => byceps/blueprints/common/user/avatar/views.py +11 -11
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.avatar.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.avatar.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 8,15 8,15 @@ byceps.blueprints.user.avatar.views

from flask import abort, g, request

from ....services.image import service as image_service
from ....services.user import service as user_service
from ....services.user_avatar import service as avatar_service
from ....signals import user_avatar as user_avatar_signals
from ....util.framework.blueprint import create_blueprint
from ....util.framework.flash import flash_notice, flash_success
from ....util.image.models import ImageType
from ....util.framework.templating import templated
from ....util.views import redirect_to, respond_no_content
from .....services.image import service as image_service
from .....services.user import service as user_service
from .....services.user_avatar import service as avatar_service
from .....signals import user_avatar as user_avatar_signals
from .....util.framework.blueprint import create_blueprint
from .....util.framework.flash import flash_notice, flash_success
from .....util.image.models import ImageType
from .....util.framework.templating import templated
from .....util.views import redirect_to, respond_no_content

from .forms import UpdateForm


R byceps/blueprints/user/creation/__init__.py => byceps/blueprints/common/user/creation/__init__.py +0 -0
R byceps/blueprints/user/creation/forms.py => byceps/blueprints/common/user/creation/forms.py +5 -5
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.creation.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.creation.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 12,9 12,9 @@ from uuid import UUID
from wtforms import BooleanField, HiddenField, PasswordField, StringField
from wtforms.validators import InputRequired, Length, ValidationError

from ....services.user import screen_name_validator
from ....services.user import service as user_service
from ....util.l10n import LocalizedForm
from .....services.user import screen_name_validator
from .....services.user import service as user_service
from .....util.l10n import LocalizedForm


EMAIL_ADDRESS_PATTERN = re.compile(r'^.+?@.+?\..+?$')

R byceps/blueprints/user/creation/templates/user/creation/create_form.html => byceps/blueprints/common/user/creation/templates/common/user/creation/create_form.html +0 -0
R byceps/blueprints/user/creation/views.py => byceps/blueprints/common/user/creation/views.py +16 -16
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.creation.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.creation.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 11,26 11,26 @@ from typing import Optional

from flask import abort, g, request

from ....config import get_app_mode
from ....services.brand import settings_service as brand_settings_service
from ....services.consent.transfer.models import Consent, SubjectID
from ....services.newsletter.transfer.models import (
from .....config import get_app_mode
from .....services.brand import settings_service as brand_settings_service
from .....services.consent.transfer.models import Consent, SubjectID
from .....services.newsletter.transfer.models import (
    ListID as NewsletterListID,
    Subscription as NewsletterSubscription,
)
from ....services.site import (
from .....services.site import (
    settings_service as site_settings_service,
    service as site_service,
)
from ....services.terms import document_service as terms_document_service
from ....services.terms import version_service as terms_version_service
from ....services.terms.transfer.models import DocumentID as TermsDocumentID
from ....services.user import creation_service as user_creation_service
from ....signals import user as user_signals
from ....util.framework.blueprint import create_blueprint
from ....util.framework.flash import flash_error, flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to
from .....services.terms import document_service as terms_document_service
from .....services.terms import version_service as terms_version_service
from .....services.terms.transfer.models import DocumentID as TermsDocumentID
from .....services.user import creation_service as user_creation_service
from .....signals import user as user_signals
from .....util.framework.blueprint import create_blueprint
from .....util.framework.flash import flash_error, flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from .forms import UserCreateForm


R byceps/blueprints/user/current/__init__.py => byceps/blueprints/common/user/current/__init__.py +0 -0
R byceps/blueprints/user/current/forms.py => byceps/blueprints/common/user/current/forms.py +5 -5
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.current.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.current.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 11,9 11,9 @@ from wtforms import DateField, PasswordField, StringField
from wtforms.fields.html5 import TelField
from wtforms.validators import InputRequired, Length, Optional

from ....services.authentication.password import service as password_service
from ....services.user import screen_name_validator, service as user_service
from ....util.l10n import LocalizedForm
from .....services.authentication.password import service as password_service
from .....services.user import screen_name_validator, service as user_service
from .....util.l10n import LocalizedForm

from ..creation.forms import ScreenNameValidator


R byceps/blueprints/user/current/templates/user/current/_account.html => byceps/blueprints/common/user/current/templates/common/user/current/_account.html +0 -0
R byceps/blueprints/user/current/templates/user/current/_details_personal.html => byceps/blueprints/common/user/current/templates/common/user/current/_details_personal.html +0 -0
R byceps/blueprints/user/current/templates/user/current/_newsletter.html => byceps/blueprints/common/user/current/templates/common/user/current/_newsletter.html +0 -0
R byceps/blueprints/user/current/templates/user/current/change_screen_name_form.html => byceps/blueprints/common/user/current/templates/common/user/current/change_screen_name_form.html +0 -0
R byceps/blueprints/user/current/templates/user/current/details_update_form.html => byceps/blueprints/common/user/current/templates/common/user/current/details_update_form.html +0 -0
R byceps/blueprints/user/current/templates/user/current/view.html => byceps/blueprints/common/user/current/templates/common/user/current/view.html +3 -3
@@ 19,10 19,10 @@
  </div>

  {%- with label_column_width = '8rem', data_column_min_width = '12rem' %}
{%- include 'user/current/_account.html' %}
{%- include 'user/current/_details_personal.html' %}
{%- include 'common/user/current/_account.html' %}
{%- include 'common/user/current/_details_personal.html' %}
    {%- if g.app_mode.is_site() and newsletter_offered %}
{%- include 'user/current/_newsletter.html' %}
{%- include 'common/user/current/_newsletter.html' %}
    {%- endif %}
  {%- endwith %}


R byceps/blueprints/user/current/views.py => byceps/blueprints/common/user/current/views.py +14 -14
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.current.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.current.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 8,18 8,18 @@ byceps.blueprints.user.current.views

from flask import abort, g, jsonify, request, Response

from ....config import get_app_mode
from ....services.country import service as country_service
from ....services.newsletter import service as newsletter_service
from ....services.user import command_service as user_command_service
from ....services.user import service as user_service
from ....signals import user as user_signals
from ....util.framework.blueprint import create_blueprint
from ....util.framework.flash import flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to

from ...authentication.decorators import login_required
from .....config import get_app_mode
from .....services.country import service as country_service
from .....services.newsletter import service as newsletter_service
from .....services.user import command_service as user_command_service
from .....services.user import service as user_service
from .....signals import user as user_signals
from .....util.framework.blueprint import create_blueprint
from .....util.framework.flash import flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from ....authentication.decorators import login_required

from ..creation.views import _find_newsletter_list_for_brand


R byceps/blueprints/user/email_address/__init__.py => byceps/blueprints/common/user/email_address/__init__.py +0 -0
R byceps/blueprints/user/email_address/forms.py => byceps/blueprints/common/user/email_address/forms.py +3 -3
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.email_address.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.email_address.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 9,7 9,7 @@ byceps.blueprints.user.email_address.forms
from wtforms import StringField
from wtforms.validators import InputRequired

from ....util.l10n import LocalizedForm
from .....util.l10n import LocalizedForm


class RequestConfirmationEmailForm(LocalizedForm):

R byceps/blueprints/user/email_address/templates/user/email_address/request_confirmation_email_form.html => byceps/blueprints/common/user/email_address/templates/common/user/email_address/request_confirmation_email_form.html +0 -0
R byceps/blueprints/user/email_address/views.py => byceps/blueprints/common/user/email_address/views.py +10 -10
@@ 1,6 1,6 @@
"""
byceps.blueprints.user.email_address.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.email_address.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 8,16 8,16 @@ byceps.blueprints.user.email_address.views

from flask import abort, g, request

from ....services.user import email_address_verification_service
from ....services.user import service as user_service
from ....services.verification_token import (
from .....services.user import email_address_verification_service
from .....services.user import service as user_service
from .....services.verification_token import (
    service as verification_token_service,
)
from ....signals import user as user_signals
from ....util.framework.blueprint import create_blueprint
from ....util.framework.flash import flash_error, flash_notice, flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to
from .....signals import user as user_signals
from .....util.framework.blueprint import create_blueprint
from .....util.framework.flash import flash_error, flash_notice, flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from .forms import RequestConfirmationEmailForm


R byceps/blueprints/user/templates/macros/user.html => byceps/blueprints/common/user/templates/macros/user.html +0 -0
R byceps/blueprints/user/views.py => byceps/blueprints/common/user/views.py +3 -3
@@ 1,12 1,12 @@
"""
byceps.blueprints.user.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.user.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from ...util.framework.blueprint import create_blueprint
from ....util.framework.blueprint import create_blueprint


blueprint = create_blueprint('user', __name__)