Improve profile modification-related logic
This commit is contained in:
parent
44451e0f0f
commit
e422c3202c
2 changed files with 9 additions and 0 deletions
|
@ -33,6 +33,14 @@ class ProfileController:
|
||||||
if profile_observer is not None:
|
if profile_observer is not None:
|
||||||
profile_observer.notify('created', profile)
|
profile_observer.notify('created', profile)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def update(profile: Union[SessionProfile, SystemProfile], profile_observer: ProfileObserver = None):
|
||||||
|
|
||||||
|
Profile.save(profile)
|
||||||
|
|
||||||
|
if profile_observer is not None:
|
||||||
|
profile_observer.notify('updated', profile)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def enable(profile: Union[SessionProfile, SystemProfile], force: bool = False, pristine: bool = False, profile_observer: ProfileObserver = None, application_version_observer: ApplicationVersionObserver = None, connection_observer: ConnectionObserver = None):
|
def enable(profile: Union[SessionProfile, SystemProfile], force: bool = False, pristine: bool = False, profile_observer: ProfileObserver = None, application_version_observer: ApplicationVersionObserver = None, connection_observer: ConnectionObserver = None):
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ProfileObserver(BaseObserver):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.on_created = []
|
self.on_created = []
|
||||||
|
self.on_updated = []
|
||||||
self.on_destroyed = []
|
self.on_destroyed = []
|
||||||
self.on_disabled = []
|
self.on_disabled = []
|
||||||
self.on_enabled = []
|
self.on_enabled = []
|
||||||
|
|
Loading…
Reference in a new issue