Make common typeclass.delete return True/False to match Object.delete api for consistency. Resolve #2398

This commit is contained in:
Griatch 2021-11-03 23:18:50 +01:00
parent 00b29a693d
commit 58f86fd3d7
4 changed files with 38 additions and 5 deletions

View file

@ -399,12 +399,20 @@ class DefaultChannel(ChannelDB, metaclass=TypeclassBase):
"""
Deletes channel.
Returns:
bool: If deletion was successful. Only time it can fail would be
if channel was already deleted. Even if it were to fail, all subscribers
will be disconnected.
"""
self.attributes.clear()
self.aliases.clear()
for subscriber in self.subscriptions.all():
self.disconnect(subscriber)
if not self.pk:
return False
super().delete()
return True
def channel_prefix(self):
"""