Add Cloudron packaging for Maubot
This commit is contained in:
19
maubot-src/maubot/lib/optionalalchemy.py
Normal file
19
maubot-src/maubot/lib/optionalalchemy.py
Normal file
@@ -0,0 +1,19 @@
|
||||
try:
|
||||
from sqlalchemy import MetaData, asc, create_engine, desc
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy.exc import IntegrityError, OperationalError
|
||||
except ImportError:
|
||||
|
||||
class FakeError(Exception):
|
||||
pass
|
||||
|
||||
class FakeType:
|
||||
def __init__(self, *args, **kwargs):
|
||||
raise Exception("SQLAlchemy is not installed")
|
||||
|
||||
def create_engine(*args, **kwargs):
|
||||
raise Exception("SQLAlchemy is not installed")
|
||||
|
||||
MetaData = Engine = FakeType
|
||||
IntegrityError = OperationalError = FakeError
|
||||
asc = desc = lambda a: a
|
||||
Reference in New Issue
Block a user