Resolve merge conflicts, some cleanup
This commit is contained in:
commit
d1baab7c0b
15 changed files with 854 additions and 29 deletions
|
|
@ -5,7 +5,7 @@ Containers
|
|||
|
||||
|
||||
from django.conf import settings
|
||||
from evennia.utils.utils import class_from_module
|
||||
from evennia.utils.utils import class_from_module, callables_from_module
|
||||
from evennia.utils import logger
|
||||
|
||||
|
||||
|
|
@ -108,3 +108,48 @@ class GlobalScriptContainer(object):
|
|||
|
||||
# Create singleton of the GlobalHandler for the API.
|
||||
GLOBAL_SCRIPTS = GlobalScriptContainer()
|
||||
|
||||
|
||||
class ValidatorContainer(object):
|
||||
"""
|
||||
Loads and stores the final list of VALIDATOR FUNCTIONS.
|
||||
|
||||
Can access these as properties or dictionary-contents.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.valid_storage = {}
|
||||
for module in settings.VALIDATOR_FUNC_MODULES:
|
||||
self.valid_storage.update(callables_from_module(module))
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self.valid_storage.get(item, None)
|
||||
|
||||
def __getattr__(self, item):
|
||||
return self[item]
|
||||
|
||||
|
||||
# Ensure that we have a Singleton of ValidHandler that is always loaded... and only needs to be loaded once.
|
||||
VALIDATOR_FUNCS = ValidatorContainer()
|
||||
|
||||
|
||||
class OptionContainer(object):
|
||||
"""
|
||||
Loads and stores the final list of OPTION CLASSES.
|
||||
|
||||
Can access these as properties or dictionary-contents.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.option_storage = {}
|
||||
for module in settings.OPTION_CLASS_MODULES:
|
||||
self.option_storage.update(callables_from_module(module))
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self.option_storage.get(item, None)
|
||||
|
||||
def __getattr__(self, item):
|
||||
return self[item]
|
||||
|
||||
|
||||
# Ensure that we have a Singleton that keeps all loaded Option classes
|
||||
OPTION_CLASSES = OptionContainer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue