Added DbObjects
This commit is contained in:
@@ -11,10 +11,11 @@ class BaseInstance:
|
||||
Base class for all instances (manageable by InstancesManager)
|
||||
"""
|
||||
|
||||
def __init__(self, session: dict, _id: str):
|
||||
def __init__(self, session: dict, _id: str, auto_register: bool = True):
|
||||
self._session = session
|
||||
self._id = _id
|
||||
InstancesManager.register(session, self)
|
||||
if auto_register:
|
||||
InstancesManager.register(session, self)
|
||||
|
||||
def get_id(self):
|
||||
return self._id
|
||||
@@ -28,8 +29,8 @@ class SingleInstance(BaseInstance):
|
||||
Base class for instances that can only have one instance at a time.
|
||||
"""
|
||||
|
||||
def __init__(self, session: dict, prefix: str):
|
||||
super().__init__(session, prefix)
|
||||
def __init__(self, session: dict, prefix: str, auto_register: bool = True):
|
||||
super().__init__(session, prefix, auto_register)
|
||||
self._instance = None
|
||||
|
||||
|
||||
@@ -38,8 +39,8 @@ class MultipleInstance(BaseInstance):
|
||||
Base class for instances that can have multiple instances at a time.
|
||||
"""
|
||||
|
||||
def __init__(self, session: dict, prefix: str):
|
||||
super().__init__(session, f"{prefix}-{str(uuid.uuid4())}")
|
||||
def __init__(self, session: dict, prefix: str, auto_register: bool = True):
|
||||
super().__init__(session, f"{prefix}-{str(uuid.uuid4())}", auto_register)
|
||||
self._instance = None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user