diff --git a/channels_redis/core.py b/channels_redis/core.py index a230081..185a426 100644 --- a/channels_redis/core.py +++ b/channels_redis/core.py @@ -169,7 +169,7 @@ async def send(self, channel, message): """ # Typecheck assert isinstance(message, dict), "message is not a dict" - assert self.valid_channel_name(channel), "Channel name not valid" + assert self.require_valid_channel_name(channel), "Channel name not valid" # Make sure the message does not contain reserved keys assert "__asgi_channel__" not in message # 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): """ # Make sure the channel name is valid then get the non-local part # and thus its index - assert self.valid_channel_name(channel) + assert self.require_valid_channel_name(channel) if "!" in channel: real_channel = self.non_local_name(channel) assert real_channel.endswith( @@ -377,7 +377,7 @@ async def receive_single(self, channel): Receives a single message off of the channel and returns it. """ # Check channel name - assert self.valid_channel_name(channel, receive=True), "Channel name invalid" + assert self.require_valid_channel_name(channel, receive=True), "Channel name invalid" # Work out the connection to use if "!" in channel: assert channel.endswith("!") @@ -482,8 +482,8 @@ async def group_add(self, group, channel): Adds the channel name to a group. """ # Check the inputs - assert self.valid_group_name(group), "Group name not valid" - assert self.valid_channel_name(channel), "Channel name not valid" + assert self.require_valid_group_name(group), "Group name not valid" + assert self.require_valid_channel_name(channel), "Channel name not valid" # Get a connection to the right shard group_key = self._group_key(group) connection = self.connection(self.consistent_hash(group)) @@ -498,8 +498,8 @@ async def group_discard(self, group, channel): Removes the channel from the named group if it is in the group; does nothing otherwise (does not error) """ - assert self.valid_group_name(group), "Group name not valid" - assert self.valid_channel_name(channel), "Channel name not valid" + assert self.require_valid_group_name(group), "Group name not valid" + assert self.require_valid_channel_name(channel), "Channel name not valid" key = self._group_key(group) connection = self.connection(self.consistent_hash(group)) await connection.zrem(key, channel) @@ -508,7 +508,7 @@ async def group_send(self, group, message): """ Sends a message to the entire group. """ - assert self.valid_group_name(group), "Group name not valid" + assert self.require_valid_group_name(group), "Group name not valid" # Retrieve list of all channel names key = self._group_key(group) connection = self.connection(self.consistent_hash(group))