From 9d6e0ae60a88d791ab534631cd4dedb9618fb4d5 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sun, 8 May 2022 15:10:48 +0200 Subject: [PATCH] fix: move myauth module from toplevel to under etebase_server This is in preparation for creating a python package, which should only occupy the "etebase_server" name in the global module namespace. --- django_etebase/token_auth/models.py | 2 +- django_etebase/utils.py | 2 +- etebase_server/fastapi/dependencies.py | 2 +- etebase_server/fastapi/routers/authentication.py | 2 +- etebase_server/fastapi/routers/collection.py | 2 +- etebase_server/fastapi/routers/invitation.py | 2 +- etebase_server/fastapi/routers/member.py | 2 +- etebase_server/fastapi/routers/test_reset_view.py | 2 +- etebase_server/fastapi/routers/websocket.py | 2 +- etebase_server/fastapi/utils.py | 2 +- {myauth => etebase_server/myauth}/__init__.py | 0 {myauth => etebase_server/myauth}/admin.py | 0 {myauth => etebase_server/myauth}/apps.py | 3 ++- {myauth => etebase_server/myauth}/forms.py | 2 +- .../myauth}/migrations/0001_initial.py | 0 .../myauth}/migrations/0002_auto_20200515_0801.py | 4 ++-- .../myauth}/migrations/0003_auto_20201119_0810.py | 6 +++--- {myauth => etebase_server/myauth}/migrations/__init__.py | 0 {myauth => etebase_server/myauth}/models.py | 0 {myauth => etebase_server/myauth}/tests.py | 0 {myauth => etebase_server/myauth}/views.py | 0 etebase_server/settings.py | 2 +- 22 files changed, 19 insertions(+), 18 deletions(-) rename {myauth => etebase_server/myauth}/__init__.py (100%) rename {myauth => etebase_server/myauth}/admin.py (100%) rename {myauth => etebase_server/myauth}/apps.py (54%) rename {myauth => etebase_server/myauth}/forms.py (92%) rename {myauth => etebase_server/myauth}/migrations/0001_initial.py (100%) rename {myauth => etebase_server/myauth}/migrations/0002_auto_20200515_0801.py (85%) rename {myauth => etebase_server/myauth}/migrations/0003_auto_20201119_0810.py (84%) rename {myauth => etebase_server/myauth}/migrations/__init__.py (100%) rename {myauth => etebase_server/myauth}/models.py (100%) rename {myauth => etebase_server/myauth}/tests.py (100%) rename {myauth => etebase_server/myauth}/views.py (100%) diff --git a/django_etebase/token_auth/models.py b/django_etebase/token_auth/models.py index dd5ae87..de2ffc1 100644 --- a/django_etebase/token_auth/models.py +++ b/django_etebase/token_auth/models.py @@ -1,7 +1,7 @@ from django.db import models from django.utils import timezone from django.utils.crypto import get_random_string -from myauth.models import get_typed_user_model +from etebase_server.myauth.models import get_typed_user_model User = get_typed_user_model() diff --git a/django_etebase/utils.py b/django_etebase/utils.py index 3a05fd4..d4aca72 100644 --- a/django_etebase/utils.py +++ b/django_etebase/utils.py @@ -3,7 +3,7 @@ from dataclasses import dataclass from django.db.models import QuerySet from django.core.exceptions import PermissionDenied -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from . import app_settings diff --git a/etebase_server/fastapi/dependencies.py b/etebase_server/fastapi/dependencies.py index 520d499..48894d6 100644 --- a/etebase_server/fastapi/dependencies.py +++ b/etebase_server/fastapi/dependencies.py @@ -8,7 +8,7 @@ from django.db.models import QuerySet from django_etebase import models from django_etebase.token_auth.models import AuthToken, get_default_expiry -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from .exceptions import AuthenticationFailed from .utils import get_object_or_404 from .db_hack import django_db_cleanup_decorator diff --git a/etebase_server/fastapi/routers/authentication.py b/etebase_server/fastapi/routers/authentication.py index fd21d21..b271357 100644 --- a/etebase_server/fastapi/routers/authentication.py +++ b/etebase_server/fastapi/routers/authentication.py @@ -19,7 +19,7 @@ from django_etebase.token_auth.models import AuthToken from django_etebase.models import UserInfo from django_etebase.signals import user_signed_up from django_etebase.utils import create_user, get_user_queryset, CallbackContext -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from ..exceptions import AuthenticationFailed, transform_validation_error, HttpError from ..msgpack import MsgpackRoute from ..utils import BaseModel, permission_responses, msgpack_encode, msgpack_decode, get_user_username_email_kwargs diff --git a/etebase_server/fastapi/routers/collection.py b/etebase_server/fastapi/routers/collection.py index c8146f2..3c2e511 100644 --- a/etebase_server/fastapi/routers/collection.py +++ b/etebase_server/fastapi/routers/collection.py @@ -8,7 +8,7 @@ from django.db.models import Q, QuerySet from fastapi import APIRouter, Depends, status, Request, BackgroundTasks from django_etebase import models -from myauth.models import UserType +from etebase_server.myauth.models import UserType from .authentication import get_authenticated_user from .websocket import get_ticket, TicketRequest, TicketOut from ..exceptions import HttpError, transform_validation_error, PermissionDenied, ValidationError diff --git a/etebase_server/fastapi/routers/invitation.py b/etebase_server/fastapi/routers/invitation.py index 7e52978..2ab2f64 100644 --- a/etebase_server/fastapi/routers/invitation.py +++ b/etebase_server/fastapi/routers/invitation.py @@ -6,7 +6,7 @@ from fastapi import APIRouter, Depends, status, Request from django_etebase import models from django_etebase.utils import get_user_queryset, CallbackContext -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from .authentication import get_authenticated_user from ..exceptions import HttpError, PermissionDenied from ..msgpack import MsgpackRoute diff --git a/etebase_server/fastapi/routers/member.py b/etebase_server/fastapi/routers/member.py index 38beb79..dff95c1 100644 --- a/etebase_server/fastapi/routers/member.py +++ b/etebase_server/fastapi/routers/member.py @@ -5,7 +5,7 @@ from django.db.models import QuerySet from fastapi import APIRouter, Depends, status from django_etebase import models -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from .authentication import get_authenticated_user from ..msgpack import MsgpackRoute from ..utils import get_object_or_404, BaseModel, permission_responses, PERMISSIONS_READ, PERMISSIONS_READWRITE diff --git a/etebase_server/fastapi/routers/test_reset_view.py b/etebase_server/fastapi/routers/test_reset_view.py index 09638e4..a66d1cc 100644 --- a/etebase_server/fastapi/routers/test_reset_view.py +++ b/etebase_server/fastapi/routers/test_reset_view.py @@ -7,7 +7,7 @@ from django_etebase.utils import get_user_queryset, CallbackContext from .authentication import SignupIn, signup_save from ..msgpack import MsgpackRoute from ..exceptions import HttpError -from myauth.models import get_typed_user_model +from etebase_server.myauth.models import get_typed_user_model test_reset_view_router = APIRouter(route_class=MsgpackRoute, tags=["test helpers"]) User = get_typed_user_model() diff --git a/etebase_server/fastapi/routers/websocket.py b/etebase_server/fastapi/routers/websocket.py index 3fc535f..19cd5e1 100644 --- a/etebase_server/fastapi/routers/websocket.py +++ b/etebase_server/fastapi/routers/websocket.py @@ -10,7 +10,7 @@ import nacl.utils from django_etebase import models from django_etebase.utils import CallbackContext, get_user_queryset -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from ..dependencies import get_collection_queryset, get_item_queryset from ..exceptions import NotSupported diff --git a/etebase_server/fastapi/utils.py b/etebase_server/fastapi/utils.py index 09c223e..b215477 100644 --- a/etebase_server/fastapi/utils.py +++ b/etebase_server/fastapi/utils.py @@ -12,7 +12,7 @@ from django.core.exceptions import ObjectDoesNotExist from django_etebase import app_settings from django_etebase.models import AccessLevels -from myauth.models import UserType, get_typed_user_model +from etebase_server.myauth.models import UserType, get_typed_user_model from .exceptions import HttpError, HttpErrorOut diff --git a/myauth/__init__.py b/etebase_server/myauth/__init__.py similarity index 100% rename from myauth/__init__.py rename to etebase_server/myauth/__init__.py diff --git a/myauth/admin.py b/etebase_server/myauth/admin.py similarity index 100% rename from myauth/admin.py rename to etebase_server/myauth/admin.py diff --git a/myauth/apps.py b/etebase_server/myauth/apps.py similarity index 54% rename from myauth/apps.py rename to etebase_server/myauth/apps.py index 96cb29b..65e21b1 100644 --- a/myauth/apps.py +++ b/etebase_server/myauth/apps.py @@ -2,4 +2,5 @@ from django.apps import AppConfig class MyauthConfig(AppConfig): - name = "myauth" + name = "etebase_server.myauth" + label = "myauth" diff --git a/myauth/forms.py b/etebase_server/myauth/forms.py similarity index 92% rename from myauth/forms.py rename to etebase_server/myauth/forms.py index fc2be74..7681835 100644 --- a/myauth/forms.py +++ b/etebase_server/myauth/forms.py @@ -1,6 +1,6 @@ from django import forms from django.contrib.auth.forms import UsernameField -from myauth.models import get_typed_user_model +from etebase_server.myauth.models import get_typed_user_model User = get_typed_user_model() diff --git a/myauth/migrations/0001_initial.py b/etebase_server/myauth/migrations/0001_initial.py similarity index 100% rename from myauth/migrations/0001_initial.py rename to etebase_server/myauth/migrations/0001_initial.py diff --git a/myauth/migrations/0002_auto_20200515_0801.py b/etebase_server/myauth/migrations/0002_auto_20200515_0801.py similarity index 85% rename from myauth/migrations/0002_auto_20200515_0801.py rename to etebase_server/myauth/migrations/0002_auto_20200515_0801.py index 068c9ae..15e35d5 100644 --- a/myauth/migrations/0002_auto_20200515_0801.py +++ b/etebase_server/myauth/migrations/0002_auto_20200515_0801.py @@ -1,7 +1,7 @@ # Generated by Django 3.0.3 on 2020-05-15 08:01 from django.db import migrations, models -import myauth.models +import etebase_server.myauth.models as myauth_models class Migration(migrations.Migration): @@ -19,7 +19,7 @@ class Migration(migrations.Migration): help_text="Required. 150 characters or fewer. Letters, digits and ./+/-/_ only.", max_length=150, unique=True, - validators=[myauth.models.UnicodeUsernameValidator()], + validators=[myauth_models.UnicodeUsernameValidator()], verbose_name="username", ), ), diff --git a/myauth/migrations/0003_auto_20201119_0810.py b/etebase_server/myauth/migrations/0003_auto_20201119_0810.py similarity index 84% rename from myauth/migrations/0003_auto_20201119_0810.py rename to etebase_server/myauth/migrations/0003_auto_20201119_0810.py index cfd2ec3..2fbc236 100644 --- a/myauth/migrations/0003_auto_20201119_0810.py +++ b/etebase_server/myauth/migrations/0003_auto_20201119_0810.py @@ -1,7 +1,7 @@ # Generated by Django 3.1.1 on 2020-11-19 08:10 from django.db import migrations, models -import myauth.models +import etebase_server.myauth.models as myauth_models class Migration(migrations.Migration): @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterModelManagers( name="user", managers=[ - ("objects", myauth.models.UserManager()), + ("objects", myauth_models.UserManager()), ], ), migrations.AlterField( @@ -30,7 +30,7 @@ class Migration(migrations.Migration): help_text="Required. 150 characters or fewer. Letters, digits and ./-/_ only.", max_length=150, unique=True, - validators=[myauth.models.UnicodeUsernameValidator()], + validators=[myauth_models.UnicodeUsernameValidator()], verbose_name="username", ), ), diff --git a/myauth/migrations/__init__.py b/etebase_server/myauth/migrations/__init__.py similarity index 100% rename from myauth/migrations/__init__.py rename to etebase_server/myauth/migrations/__init__.py diff --git a/myauth/models.py b/etebase_server/myauth/models.py similarity index 100% rename from myauth/models.py rename to etebase_server/myauth/models.py diff --git a/myauth/tests.py b/etebase_server/myauth/tests.py similarity index 100% rename from myauth/tests.py rename to etebase_server/myauth/tests.py diff --git a/myauth/views.py b/etebase_server/myauth/views.py similarity index 100% rename from myauth/views.py rename to etebase_server/myauth/views.py diff --git a/etebase_server/settings.py b/etebase_server/settings.py index 07a50b0..f1db11e 100644 --- a/etebase_server/settings.py +++ b/etebase_server/settings.py @@ -54,7 +54,7 @@ INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", - "myauth.apps.MyauthConfig", + "etebase_server.myauth.apps.MyauthConfig", "django_etebase.apps.DjangoEtebaseConfig", "django_etebase.token_auth.apps.TokenAuthConfig", ]