29 lines
565 B
Python
29 lines
565 B
Python
|
|
# retoor <retoor@molodetz.nl>
|
||
|
|
|
||
|
|
import os
|
||
|
|
|
||
|
|
|
||
|
|
def _activate() -> None:
|
||
|
|
if os.environ.get("DEVPLACE_DB_SERVICE") == "1":
|
||
|
|
return
|
||
|
|
if os.environ.get("DEVPLACE_REMOTE_DB") == "1":
|
||
|
|
from devplacepy.database.remote import activate
|
||
|
|
|
||
|
|
activate()
|
||
|
|
|
||
|
|
|
||
|
|
_activate()
|
||
|
|
|
||
|
|
import devplacepy.database as _database
|
||
|
|
|
||
|
|
|
||
|
|
def _remote_table(table) -> bool:
|
||
|
|
return type(table).__name__ == "RemoteTable"
|
||
|
|
|
||
|
|
|
||
|
|
def __getattr__(name: str):
|
||
|
|
return getattr(_database, name)
|
||
|
|
|
||
|
|
|
||
|
|
def __dir__():
|
||
|
|
return sorted(name for name in dir(_database) if not name.startswith("_"))
|