mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-08 11:56:59 +00:00
5acd0ceae9
Slice 2e of the route-domain reorganization (#4082/#4071, per specs/architecture-runtime-inventory.md §6.3). Moves contacts_routes.py into routes/contacts/, leaving a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change. The shim uses sys.modules replacement (same pattern as the merged gallery #4903, research #4975, memory #5007, and history #5090 slices) so that `import routes.contacts_routes`, `from routes.contacts_routes import X`, `importlib.import_module(...)`, the string-targeted `monkeypatch.setattr("routes.contacts_routes.SETTINGS_FILE", ...)` used by test_carddav_password_encryption.py, and the `import ... as cr` + `setattr(cr, ...)` pattern in test_contacts_add_null_name.py all operate on the same module object the application uses. This also keeps the mutable module state `_contact_cache` identical across import paths. The canonical module does NOT depend on the shim — routes/contacts/ contacts_routes.py imports only from core/, src/, and stdlib (zero internal routes/ coupling). The inbound edge from routes/email_helpers.py (imports _fetch_contacts) keeps working through the shim. Zero source-introspection landmines — no test reads this file by path. Adds tests/test_contacts_routes_shim.py to pin the sys.modules shim contract (same-object + string-targeted monkeypatch reach-through). Verified: compileall clean; full suite 4485 passed, 3 skipped.
21 lines
1001 B
Python
21 lines
1001 B
Python
"""Backward-compat shim — canonical location is routes/contacts/contacts_routes.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.contacts_routes``, ``from routes.contacts_routes import X``,
|
|
``importlib.import_module("routes.contacts_routes")``, and the string-targeted
|
|
``monkeypatch.setattr("routes.contacts_routes.SETTINGS_FILE", ...)`` pattern
|
|
used by test_carddav_password_encryption.py / test_contacts_carddav_security.py
|
|
— plus the ``import ... as contacts_routes`` + ``setattr(...)`` pattern in
|
|
test_contacts_add_null_name.py — all operate on the *same* object the
|
|
application actually uses. This also keeps ``_contact_cache`` (mutable module
|
|
state) identical across import paths. Keeps existing import paths working
|
|
after slice 2e (#4082/#4071). No source-introspection tests read this file
|
|
by path.
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.contacts import contacts_routes as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|