Skip to content

Commit 26f3f8f

Browse files
committed
Renamed internal methods in core channel layer.
Internal API was renamed in Channels 4.2.1
1 parent b359bf7 commit 26f3f8f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

channels_redis/core.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async def send(self, channel, message):
169169
"""
170170
# Typecheck
171171
assert isinstance(message, dict), "message is not a dict"
172-
assert self.valid_channel_name(channel), "Channel name not valid"
172+
assert self.require_valid_channel_name(channel), "Channel name not valid"
173173
# Make sure the message does not contain reserved keys
174174
assert "__asgi_channel__" not in message
175175
# If it's a process-local channel, strip off local part and stick full name in message
@@ -256,7 +256,7 @@ async def receive(self, channel):
256256
"""
257257
# Make sure the channel name is valid then get the non-local part
258258
# and thus its index
259-
assert self.valid_channel_name(channel)
259+
assert self.require_valid_channel_name(channel)
260260
if "!" in channel:
261261
real_channel = self.non_local_name(channel)
262262
assert real_channel.endswith(
@@ -377,7 +377,9 @@ async def receive_single(self, channel):
377377
Receives a single message off of the channel and returns it.
378378
"""
379379
# Check channel name
380-
assert self.valid_channel_name(channel, receive=True), "Channel name invalid"
380+
assert self.require_valid_channel_name(
381+
channel, receive=True
382+
), "Channel name invalid"
381383
# Work out the connection to use
382384
if "!" in channel:
383385
assert channel.endswith("!")
@@ -482,8 +484,8 @@ async def group_add(self, group, channel):
482484
Adds the channel name to a group.
483485
"""
484486
# Check the inputs
485-
assert self.valid_group_name(group), "Group name not valid"
486-
assert self.valid_channel_name(channel), "Channel name not valid"
487+
assert self.require_valid_group_name(group), "Group name not valid"
488+
assert self.require_valid_channel_name(channel), "Channel name not valid"
487489
# Get a connection to the right shard
488490
group_key = self._group_key(group)
489491
connection = self.connection(self.consistent_hash(group))
@@ -498,8 +500,8 @@ async def group_discard(self, group, channel):
498500
Removes the channel from the named group if it is in the group;
499501
does nothing otherwise (does not error)
500502
"""
501-
assert self.valid_group_name(group), "Group name not valid"
502-
assert self.valid_channel_name(channel), "Channel name not valid"
503+
assert self.require_valid_group_name(group), "Group name not valid"
504+
assert self.require_valid_channel_name(channel), "Channel name not valid"
503505
key = self._group_key(group)
504506
connection = self.connection(self.consistent_hash(group))
505507
await connection.zrem(key, channel)
@@ -508,7 +510,7 @@ async def group_send(self, group, message):
508510
"""
509511
Sends a message to the entire group.
510512
"""
511-
assert self.valid_group_name(group), "Group name not valid"
513+
assert self.require_valid_group_name(group), "Group name not valid"
512514
# Retrieve list of all channel names
513515
key = self._group_key(group)
514516
connection = self.connection(self.consistent_hash(group))

0 commit comments

Comments
 (0)