generated from coulomb/repo-seed
issue-facade was renamed to issue-core. Update the dependency declaration and the three Python imports it touched. Model field names (issue_facade_backend, issue_facade_id) and the Django setting ISSUE_FACADE_LOCAL_DB stay as-is — they are persisted/semantic identifiers, not part of the package wiring. All 20 aufgaben tests pass after the rewire. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
from contextlib import contextmanager
|
|
from pathlib import Path
|
|
|
|
|
|
@contextmanager
|
|
def local_backend():
|
|
from django.conf import settings
|
|
from issue_core.backends.local import LocalSQLiteBackend
|
|
|
|
db_path = str(getattr(settings, 'ISSUE_FACADE_LOCAL_DB', '.issue-facade/issues.db'))
|
|
Path(db_path).parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
b = LocalSQLiteBackend()
|
|
b.connect({'db_path': db_path})
|
|
try:
|
|
yield b
|
|
finally:
|
|
b.disconnect()
|
|
|
|
|
|
@contextmanager
|
|
def remote_backend():
|
|
"""Yields GiteaBackend wenn konfiguriert, sonst None."""
|
|
from django.conf import settings
|
|
from issue_core.backends.gitea import GiteaBackend
|
|
|
|
cfg = getattr(settings, 'ISSUE_FACADE_GITEA', None)
|
|
if not cfg:
|
|
yield None
|
|
return
|
|
|
|
b = GiteaBackend()
|
|
b.connect(cfg)
|
|
try:
|
|
yield b
|
|
finally:
|
|
b.disconnect()
|
|
|
|
|
|
def gitea_configured() -> bool:
|
|
from django.conf import settings
|
|
cfg = getattr(settings, 'ISSUE_FACADE_GITEA', None)
|
|
return bool(cfg and cfg.get('token'))
|