You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
all Class derived from Model are sharing the same observers !!!
causing event will fire multi times on all observers which listen to this event type
To Reproduce
from masoniteorm import Model
class A(Model):
pass
class B(Model):
pass
class AObserver:
def booting(self, obj):
print('Booting A %s' % obj)
class BObserver:
def booting(self, obj):
print('Booting B %s' % obj)
A.observe(AObserver())
B.observe(BObserver())
a = A()
# Booting A <__main__.A object at 0x000001AEBFC47220>
# Booting B <__main__.A object at 0x000001AEBFC47220>
print(id(A.__observers__) == id(B.__observers__))
# True
print(A.__observers__)
# [<__main__.AObserver object at 0x000001AEBFC65730>, <__main__.BObserver object at 0x000001AEBFC47910>]
Expected behavior
A() cause AObserver and BObserver both fired
and A.observers === B.observers is bugly TRUE
Desktop (please complete the following information):
OS: All platforms
Version: All
What database are you using?
Type: All
Version All
Masonite ORM latest(1.0)
The text was updated successfully, but these errors were encountered:
Describe the bug
all Class derived from Model are sharing the same observers !!!
causing event will fire multi times on all observers which listen to this event type
To Reproduce
Expected behavior
A() cause AObserver and BObserver both fired
and A.observers === B.observers is bugly TRUE
Desktop (please complete the following information):
What database are you using?
The text was updated successfully, but these errors were encountered: