feat(#357): Paket 6 — Contact-Model ins ContactsPlugin (physischer Move + PEP-562-Lazy-Re-Export-Bruecke, ALEMBIC_OWNED_TABLES gegen Schema-Dual-Ownership, outbox-Vorbestands-Fix in models/__init__)
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
+20
-1
@@ -8,7 +8,11 @@ from app.models.backup import Backup
|
||||
from app.models.bank_account import BankAccount
|
||||
from app.models.compliance import ComplianceIncident
|
||||
from app.models.consumer_inbox import ConsumerInbox
|
||||
from app.models.contact import Contact, ContactPerson
|
||||
|
||||
# Contact/ContactPerson: lazy via package __getattr__ (Paket 6) — the physical
|
||||
# model lives in app.plugins.builtins.contacts.models; importing the plugin
|
||||
# framework while app.models is still initializing caused a proven circular
|
||||
# ImportError (app.core.auth -> app.models.session -> ... -> app.plugins).
|
||||
from app.models.contact_folder import ContactFolder
|
||||
from app.models.contact_merge import ContactMergeHistory
|
||||
from app.models.currency import Currency
|
||||
@@ -18,6 +22,7 @@ from app.models.entity_permission import EntityPermission
|
||||
from app.models.entity_policy import EntityPolicy
|
||||
from app.models.group import Group, UserGroup
|
||||
from app.models.notification import Notification, NotificationPreference, NotificationType
|
||||
from app.models.outbox import EventOutbox, OutboxDelivery
|
||||
from app.models.owned_mixin import OwnedMixin
|
||||
from app.models.permission_delegation import PermissionDelegation
|
||||
from app.models.permission_template import PermissionTemplate
|
||||
@@ -83,3 +88,17 @@ from app.models.workspace import ( # noqa: F401
|
||||
WorkspaceUser,
|
||||
WorkspaceWidget,
|
||||
)
|
||||
|
||||
|
||||
# ── Lazy Contact re-export (Paket 6, #357) ──────────────────────────────────
|
||||
# The physical home of Contact/ContactPerson is the ContactsPlugin
|
||||
# (app.plugins.builtins.contacts.models). Resolving them lazily via package
|
||||
# __getattr__ keeps ``from app.models import *`` (alembic/env.py) working
|
||||
# while avoiding a plugin-framework import during app.models initialization
|
||||
# (proven circular ImportError, see app/models/contact.py).
|
||||
def __getattr__(name: str):
|
||||
if name in {"Contact", "ContactPerson"}:
|
||||
from app.models.contact import Contact, ContactPerson
|
||||
|
||||
return {"Contact": Contact, "ContactPerson": ContactPerson}[name]
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
Reference in New Issue
Block a user