Made defaults drawn from settings file to allow them to be modified

This commit is contained in:
Tehom 2017-02-10 03:43:18 -05:00 committed by Griatch
parent f538b65279
commit a54e511413
2 changed files with 12 additions and 4 deletions

View file

@ -7,6 +7,9 @@ All commands in Evennia inherit from the 'Command' class in this module.
from builtins import range from builtins import range
import re import re
from django.conf import settings
from evennia.locks.lockhandler import LockHandler from evennia.locks.lockhandler import LockHandler
from evennia.utils.utils import is_iter, fill, lazy_property, make_iter from evennia.utils.utils import is_iter, fill, lazy_property, make_iter
from future.utils import with_metaclass from future.utils import with_metaclass
@ -140,17 +143,17 @@ class Command(with_metaclass(CommandMeta, object)):
aliases = [] aliases = []
# a list of lock definitions on the form # a list of lock definitions on the form
# cmd:[NOT] func(args) [ AND|OR][ NOT] func2(args) # cmd:[NOT] func(args) [ AND|OR][ NOT] func2(args)
locks = "" locks = settings.DEFAULT_COMMAND_LOCKS
# used by the help system to group commands in lists. # used by the help system to group commands in lists.
help_category = "general" help_category = settings.DEFAULT_COMMAND_HELP_CATEGORY
# This allows to turn off auto-help entry creation for individual commands. # This allows to turn off auto-help entry creation for individual commands.
auto_help = True auto_help = True
# optimization for quickly separating exit-commands from normal commands # optimization for quickly separating exit-commands from normal commands
is_exit = False is_exit = False
# define the command not only by key but by the regex form of its arguments # define the command not only by key but by the regex form of its arguments
arg_regex = None arg_regex = settings.DEFAULT_COMMAND_ARG_REGEX
# whether we share msgs automatically with all sessions # whether we share msgs automatically with all sessions
share_msgs = False share_msgs = settings.DEFAULT_COMMAND_MSG_SHARE
# auto-set (by Evennia on command instantiation) are: # auto-set (by Evennia on command instantiation) are:
# obj - which object this command is defined on # obj - which object this command is defined on

View file

@ -347,6 +347,11 @@ COMMAND_DEFAULT_CLASS = "evennia.commands.default.muxcommand.MuxCommand"
# default class logs channel messages to a file and allows for /history. # default class logs channel messages to a file and allows for /history.
# This setting allows to override the command class used with your own. # This setting allows to override the command class used with your own.
CHANNEL_COMMAND_CLASS = "evennia.comms.channelhandler.ChannelCommand" CHANNEL_COMMAND_CLASS = "evennia.comms.channelhandler.ChannelCommand"
# These specify defaults to the base Command parent class
DEFAULT_COMMAND_ARG_REGEX = None
DEFAULT_COMMAND_MSG_SHARE = False
DEFAULT_COMMAND_HELP_CATEGORY = "general"
DEFAULT_COMMAND_LOCKS = ""
###################################################################### ######################################################################
# Typeclasses and other paths # Typeclasses and other paths