Merge pull request #2255 from kcoram/fix-accounts-null-errors

Add null checking when getting puppet from session
This commit is contained in:
Griatch 2020-11-21 18:17:24 +01:00 committed by GitHub
commit 9d90b52266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -373,7 +373,7 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
puppet (Object): The matching puppeted object, if any.
"""
return session.puppet
return session.puppet if session else None
def get_all_puppets(self):
"""

View file

@ -999,7 +999,7 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
self.msg("Already quelling Account %s permissions." % permstr)
return
account.attributes.add("_quell", True)
puppet = self.session.puppet
puppet = self.session.puppet if self.session else None
if puppet:
cpermstr = "(%s)" % ", ".join(puppet.permissions.all())
cpermstr = "Quelling to current puppet's permissions %s." % cpermstr