Handle websocket autoconnect and remove session duplicates. Resolves #1851. Resolves #1562.

This commit is contained in:
Griatch 2019-06-15 22:24:32 +02:00
parent 993113b2b7
commit 005b3f4530
13 changed files with 114 additions and 64 deletions

View file

@ -414,6 +414,14 @@ class Command(with_metaclass(CommandMeta, object)):
set in self.parse())
"""
variables = '\n'.join(" |w{}|n ({}): {}".format(key, type(val), val) for key, val in self.__dict__.items())
string = f"""
Command {self} has no defined `func()` - showing on-command variables:
{variables}
"""
self.caller.msg(string)
return
# a simple test command to show the available properties
string = "-" * 50
string += "\n|w%s|n - Command variables from evennia:\n" % self.key

View file

@ -200,6 +200,13 @@ class MuxCommand(Command):
by the cmdhandler right after self.parser() finishes, and so has access
to all the variables defined therein.
"""
variables = '\n'.join(" |w{}|n ({}): {}".format(key, type(val), val) for key, val in self.__dict__.items())
string = f"""
Command {self} has no defined `func()` - showing on-command variables: No child func() defined for {self} - available variables:
{variables}
"""
self.caller.msg(string)
return
# a simple test command to show the available properties
string = "-" * 50
string += "\n|w%s|n - Command variables from evennia:\n" % self.key

View file

@ -446,7 +446,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
nobjs = nobjs or 1 # fix zero-div error with empty database
# total object sum table
totaltable = self.style_table("|wtype|n", "|wcomment|n", "|wcount|n", "|w%%|n",
totaltable = self.style_table("|wtype|n", "|wcomment|n", "|wcount|n", "|w%|n",
border="table", align="l")
totaltable.align = 'l'
totaltable.add_row("Characters", "(BASE_CHARACTER_TYPECLASS + children)",
@ -458,7 +458,8 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
totaltable.add_row("Other", "", nother, "%.2f" % ((float(nother) / nobjs) * 100))
# typeclass table
typetable = self.style_table("|wtypeclass|n", "|wcount|n", "|w%%|n", border="table", align="l")
typetable = self.style_table("|wtypeclass|n", "|wcount|n", "|w%|n",
border="table", align="l")
typetable.align = 'l'
dbtotals = ObjectDB.objects.object_totals()
for path, count in dbtotals.items():
@ -466,7 +467,8 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
# last N table
objs = ObjectDB.objects.all().order_by("db_date_created")[max(0, nobjs - nlim):]
latesttable = self.style_table("|wcreated|n", "|wdbref|n", "|wname|n", "|wtypeclass|n", align="l", border="table")
latesttable = self.style_table("|wcreated|n", "|wdbref|n", "|wname|n",
"|wtypeclass|n", align="l", border="table")
latesttable.align = 'l'
for obj in objs:
latesttable.add_row(utils.datetime_format(obj.date_created),