mirror of
https://github.com/django/daphne.git
synced 2025-07-11 00:12:18 +03:00
Fixed #482: Group_names not updated right in base classes.
This commit is contained in:
parent
37da462411
commit
05b5fa5216
|
@ -142,7 +142,7 @@ class Binding(object):
|
||||||
if action == CREATE:
|
if action == CREATE:
|
||||||
group_names = set()
|
group_names = set()
|
||||||
else:
|
else:
|
||||||
group_names = set(cls.group_names(instance, action))
|
group_names = set(cls.group_names(instance))
|
||||||
|
|
||||||
if not hasattr(instance, '_binding_group_names'):
|
if not hasattr(instance, '_binding_group_names'):
|
||||||
instance._binding_group_names = {}
|
instance._binding_group_names = {}
|
||||||
|
@ -157,7 +157,7 @@ class Binding(object):
|
||||||
if action == DELETE:
|
if action == DELETE:
|
||||||
new_group_names = set()
|
new_group_names = set()
|
||||||
else:
|
else:
|
||||||
new_group_names = set(cls.group_names(instance, action))
|
new_group_names = set(cls.group_names(instance))
|
||||||
|
|
||||||
# if post delete, new_group_names should be []
|
# if post delete, new_group_names should be []
|
||||||
self = cls()
|
self = cls()
|
||||||
|
@ -186,7 +186,7 @@ class Binding(object):
|
||||||
group.send(message)
|
group.send(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
"""
|
"""
|
||||||
Returns the iterable of group names to send the object to based on the
|
Returns the iterable of group names to send the object to based on the
|
||||||
instance and action performed on it.
|
instance and action performed on it.
|
||||||
|
|
|
@ -21,7 +21,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['username', 'email', 'password', 'last_name']
|
fields = ['username', 'email', 'password', 'last_name']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ["users"]
|
return ["users"]
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -62,7 +62,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
exclude = ['first_name', 'last_name']
|
exclude = ['first_name', 'last_name']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ["users_exclude"]
|
return ["users_exclude"]
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -105,7 +105,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
stream = 'test'
|
stream = 'test'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ["users_omit"]
|
return ["users_omit"]
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -119,7 +119,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['__all__']
|
fields = ['__all__']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ["users2"]
|
return ["users2"]
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -164,7 +164,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['username']
|
fields = ['username']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ["users3"]
|
return ["users3"]
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -203,7 +203,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['username', 'email', 'password', 'last_name']
|
fields = ['username', 'email', 'password', 'last_name']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ['users_outbound']
|
return ['users_outbound']
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -243,7 +243,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['username', ]
|
fields = ['username', ]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ['users_outbound']
|
return ['users_outbound']
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
@ -289,7 +289,7 @@ class TestsBinding(ChannelTestCase):
|
||||||
fields = ['username', ]
|
fields = ['username', ]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def group_names(cls, instance, action):
|
def group_names(cls, instance):
|
||||||
return ['users_outbound']
|
return ['users_outbound']
|
||||||
|
|
||||||
def has_permission(self, user, action, pk):
|
def has_permission(self, user, action, pk):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user