Removed the conf/ modules, putting them into conf/examples instead, in line with other API changes. The gamesrc/ folder is now completely empty and all new modules have to be added explicitly.

This commit is contained in:
Griatch 2012-03-25 19:52:51 +02:00
parent bdb5ab0123
commit e042366f31
11 changed files with 72 additions and 30 deletions

View file

@ -20,7 +20,7 @@ MSSP_VAL = chr(2)
# try to get the customized mssp info, if it exists.
MSSPTable_CUSTOM = utils.variable_from_module("game.gamesrc.conf.mssp", "MSSPTable", default={})
MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={})
class Mssp(object):
"""
@ -167,7 +167,8 @@ class Mssp(object):
"XTERM 256 COLORS": "0"}
# update the static table with the custom one
self.mssp_table.update(MSSPTable_CUSTOM)
if MSSPTable_CUSTOM:
self.mssp_table.update(MSSPTable_CUSTOM)
varlist = ''
for variable, value in self.mssp_table.items():

View file

@ -163,7 +163,8 @@ class Evennia(object):
[(p.typeclass, p.at_init()) for p in PlayerDB.get_all_cached_instances()]
# call server hook.
SERVER_HOOK_MODULE.at_server_start()
if SERVER_HOOK_MODULE:
SERVER_HOOK_MODULE.at_server_start()
def terminal_output(self):
"""

View file

@ -157,19 +157,20 @@ SEARCH_AT_MULTIMATCH_INPUT = "src.commands.cmdparser.at_multimatch_input"
# The module holding text strings for the connection screen.
# This module should contain one or more variables
# with strings defining the look of the screen.
CONNECTION_SCREEN_MODULE = "game.gamesrc.conf.connection_screens"
CONNECTION_SCREEN_MODULE = "src.commands.connection_screen"
# An option al module that, if existing, must hold a function
# named at_initial_setup(). This hook method can be used to customize
# the server's initial setup sequence (the very first startup of the system).
# The check will fail quietly if module doesn't exist or fails to load.
AT_INITIAL_SETUP_HOOK_MODULE = "game.gamesrc.conf.at_initial_setup"
AT_INITIAL_SETUP_HOOK_MODULE = ""
# Module holding at_server_start(), at_server_reload() and
# at_server_stop() methods. These methods will be called every time
# the server starts, reloads and resets/stops.
AT_SERVER_STARTSTOP_MODULE = "game.gamesrc.conf.at_server_startstop"
AT_SERVER_STARTSTOP_MODULE = ""
# Module holding server-side functions for out-of-band protocols to call.
OOB_FUNC_MODULE = "game.gamesrc.conf.oobfuncs"
OOB_FUNC_MODULE = ""
# Module holding MSSP meta data
MSSP_META_MODULE = ""
###################################################
# Default command sets
@ -258,7 +259,7 @@ PERMISSION_HIERARCHY = ("Players","PlayerHelpers","Builders", "Wizards", "Immort
PERMISSION_PLAYER_DEFAULT = "Players"
# Tuple of modules implementing lock functions. All callable functions
# inside these modules will be available as lock functions.
LOCK_FUNC_MODULES = ("src.locks.lockfuncs","game.gamesrc.conf.lockfuncs")
LOCK_FUNC_MODULES = ("src.locks.lockfuncs",)
###################################################

View file

@ -566,6 +566,8 @@ def mod_import(mod_path, propname=None):
for line in errmsg.splitlines():
log.msg('[EE] %s' % line)
if not mod_path:
return None
# first try to import as a python path
try:
mod = __import__(mod_path, fromlist=["None"])
@ -610,6 +612,8 @@ def variable_from_module(modpath, variable, default=None):
If module cannot be imported or variable not found, default
is returned.
"""
if not modpath:
return None
try:
mod = __import__(modpath, fromlist=["None"])
return mod.__dict__.get(variable, default)