Adjusting checks to use utils.inherits_from()
This commit is contained in:
parent
30bfc36beb
commit
26643a71a7
8 changed files with 26 additions and 15 deletions
|
|
@ -277,6 +277,7 @@ from django.conf import settings
|
|||
# i18n
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
import evennia
|
||||
from evennia import CmdSet, Command
|
||||
from evennia.commands import cmdhandler
|
||||
from evennia.utils import logger
|
||||
|
|
@ -291,6 +292,7 @@ from evennia.utils.utils import (
|
|||
mod_import,
|
||||
pad,
|
||||
to_str,
|
||||
inherits_from,
|
||||
)
|
||||
|
||||
# read from protocol NAWS later?
|
||||
|
|
@ -423,7 +425,7 @@ class CmdEvMenuNode(Command):
|
|||
if _restore(caller):
|
||||
return
|
||||
orig_caller = caller
|
||||
caller = caller.account if hasattr(caller, "has_account") else None
|
||||
caller = caller.account if inherits_from(caller, evennia.DefaultObject) else None
|
||||
menu = caller.ndb._evmenu if caller else None
|
||||
if not menu:
|
||||
if caller and _restore(caller):
|
||||
|
|
@ -1497,7 +1499,7 @@ class CmdGetInput(Command):
|
|||
caller = self.caller
|
||||
try:
|
||||
getinput = caller.ndb._getinput
|
||||
if not getinput and (hasattr(caller, "has_account")):
|
||||
if not getinput and inherits_from(caller, evennia.DefaultObject):
|
||||
getinput = caller.account.ndb._getinput
|
||||
if getinput:
|
||||
caller = caller.account
|
||||
|
|
@ -1618,7 +1620,9 @@ class CmdYesNoQuestion(Command):
|
|||
|
||||
def _clean(self, caller):
|
||||
del caller.ndb._yes_no_question
|
||||
if not caller.cmdset.has(YesNoQuestionCmdSet) and hasattr(caller, "has_account"):
|
||||
if not caller.cmdset.has(YesNoQuestionCmdSet) and inherits_from(
|
||||
caller, evennia.DefaultObject
|
||||
):
|
||||
caller.account.cmdset.remove(YesNoQuestionCmdSet)
|
||||
else:
|
||||
caller.cmdset.remove(YesNoQuestionCmdSet)
|
||||
|
|
@ -1628,7 +1632,7 @@ class CmdYesNoQuestion(Command):
|
|||
caller = self.caller
|
||||
try:
|
||||
yes_no_question = caller.ndb._yes_no_question
|
||||
if not yes_no_question and hasattr(caller, "has_account"):
|
||||
if not yes_no_question and inherits_from(caller, evennia.DefaultObject):
|
||||
yes_no_question = caller.account.ndb._yes_no_question
|
||||
caller = caller.account
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ from django.core.paginator import Paginator
|
|||
from django.db.models.query import QuerySet
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
import evennia
|
||||
from evennia.commands import cmdhandler
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.command import Command
|
||||
|
|
@ -78,7 +79,7 @@ class CmdMore(Command):
|
|||
Implement the command
|
||||
"""
|
||||
more = self.caller.ndb._more
|
||||
if not more and hasattr(self.caller, "has_account"):
|
||||
if not more and inherits_from(self.caller, evennia.DefaultObject):
|
||||
more = self.caller.account.ndb._more
|
||||
if not more:
|
||||
self.caller.msg("Error in loading the pager. Contact an admin.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue