Add CHANNEL_HANDLER_CLASS setting to replace ChannelHandler.

This commit is contained in:
Griatch 2020-01-18 00:14:29 +01:00
parent e09be824ca
commit 5e5f3efc24
3 changed files with 18 additions and 5 deletions

View file

@ -40,6 +40,7 @@ without arguments starts a full interactive Python console.
of texts (such as tables). New `justify` bool. Old `justify_kwargs` remains
but is now only used to pass extra kwargs into the justify function.
- Improve performance of `find` and `objects` commands on large data sets (strikaco)
- New `CHANNEL_HANDLER_CLASS` setting allows for replacing the ChannelHandler entirely.
## Evennia 0.9 (2018-2019)

View file

@ -29,6 +29,10 @@ from evennia.utils.logger import tail_log_file
from evennia.utils.utils import class_from_module
from django.utils.translation import ugettext as _
# we must late-import these since any overloads are likely to
# themselves be using these classes leading to a circular import.
_CHANNEL_HANDLER_CLASS = None
_CHANNEL_COMMAND_CLASS = None
_CHANNELDB = None
@ -314,5 +318,6 @@ class ChannelHandler(object):
return chan_cmdset
CHANNEL_HANDLER = ChannelHandler()
# set up the singleton
CHANNEL_HANDLER = class_from_module(settings.CHANNEL_HANDLER_CLASS)()
CHANNELHANDLER = CHANNEL_HANDLER # legacy

View file

@ -446,10 +446,17 @@ COMMAND_DEFAULT_MSG_ALL_SESSIONS = False
COMMAND_DEFAULT_HELP_CATEGORY = "general"
# The default lockstring of a command.
COMMAND_DEFAULT_LOCKS = ""
# The Channel Handler will create a command to represent each channel,
# creating it with the key of the channel, its aliases, locks etc. The
# default class logs channel messages to a file and allows for /history.
# This setting allows to override the command class used with your own.
# The Channel Handler is responsible for managing all available channels. By
# default it builds the current channels into a channel-cmdset that it feeds
# to the cmdhandler. Overloading this can completely change how Channels
# are identified and called.
CHANNEL_HANDLER_CLASS = "evennia.comms.channelhandler.ChannelHandler"
# The (default) Channel Handler will create a command to represent each
# channel, creating it with the key of the channel, its aliases, locks etc. The
# default class logs channel messages to a file and allows for /history. This
# setting allows to override the command class used with your own.
# If you implement CHANNEL_HANDLER_CLASS, you can change this directly and will
# likely not need this setting.
CHANNEL_COMMAND_CLASS = "evennia.comms.channelhandler.ChannelCommand"
######################################################################