Added CharactersHandler to account and altered all calls of add/remove characters to use it.

This commit is contained in:
Andrew Bastien 2023-09-10 12:23:56 -04:00
parent 3c4a3f1088
commit 2bf96f7c7f
11 changed files with 112 additions and 63 deletions

View file

@ -319,7 +319,7 @@ class ObjectAdmin(admin.ModelAdmin):
if account:
account.db._last_puppet = obj
account.add_character_to_playable_list(obj)
account.characters.add(obj)
if not obj.access(account, "puppet"):
lock = obj.locks.get("puppet")
lock += f" or pid({account.id})"

View file

@ -35,8 +35,8 @@ class EvenniaWebTest(BaseEvenniaTest):
super().setUp()
# Add chars to account rosters
self.account.add_character_to_playable_list(self.char1)
self.account2.add_character_to_playable_list(self.char2)
self.account.characters.add(self.char1)
self.account2.characters.add(self.char2)
for account in (self.account, self.account2):
# Demote accounts to Player permissions
@ -220,7 +220,7 @@ class CharacterCreateView(EvenniaWebTest):
@override_settings(MAX_NR_CHARACTERS=1)
def test_valid_access_multisession_0(self):
"Account1 with no characters should be able to create a new one"
self.account.remove_character_from_playable_list(self.char1)
self.account.characters.remove(self.char1)
# Login account
self.login()

View file

@ -102,7 +102,7 @@ def collect_topics(account):
cmd_help_topics = []
if not str(account) == "AnonymousUser":
# create list of account and account's puppets
puppets = account.characters + [account]
puppets = account.characters.all() + [account]
# add the account's and puppets' commands to cmd_help_topics list
for puppet in puppets:
for cmdset in puppet.cmdset.get():