mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix pre-emptive import bug introduced in container
This commit is contained in:
parent
a5f19e8b92
commit
f9ba117680
2 changed files with 17 additions and 6 deletions
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
Contrib by Griatch 2022
|
||||
|
||||
|
||||
```{warning}
|
||||
NOTE - this tutorial is WIP and NOT complete! It was put on hold to focus on
|
||||
releasing Evennia 1.0. You will still learn things from it, but don't expect
|
||||
perfection.
|
||||
```
|
||||
|
||||
A complete example MUD using Evennia. This is the final result of what is
|
||||
implemented if you follow the Getting-Started tutorial. It's recommended
|
||||
that you follow the tutorial step by step and write your own code. But if
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ evennia.OPTION_CLASSES
|
|||
|
||||
|
||||
from pickle import dumps
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
from django.conf import settings
|
||||
from evennia.utils.utils import class_from_module, callables_from_module
|
||||
from evennia.utils import logger
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
from evennia.utils import logger
|
||||
from evennia.utils.utils import callables_from_module, class_from_module
|
||||
|
||||
SCRIPTDB = None
|
||||
_BASE_SCRIPT_TYPECLASS = None
|
||||
|
||||
|
||||
class Container:
|
||||
|
|
@ -106,7 +107,6 @@ class GlobalScriptContainer(Container):
|
|||
callables from settings but a custom dict of tuples.
|
||||
|
||||
"""
|
||||
__BASE_SCRIPT_TYPECLASS = class_from_module(settings.BASE_SCRIPT_TYPECLASS)
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
|
|
@ -201,13 +201,17 @@ class GlobalScriptContainer(Container):
|
|||
initialized.
|
||||
|
||||
"""
|
||||
global _BASE_SCRIPT_TYPECLASS
|
||||
if not _BASE_SCRIPT_TYPECLASS:
|
||||
_BASE_SCRIPT_TYPECLASS = class_from_module(settings.BASE_SCRIPT_TYPECLASS)
|
||||
|
||||
if self.typeclass_storage is None:
|
||||
self.typeclass_storage = {}
|
||||
for key, data in list(self.loaded_data.items()):
|
||||
try:
|
||||
typeclass = data.get("typeclass", settings.BASE_SCRIPT_TYPECLASS)
|
||||
script_typeclass = class_from_module(typeclass)
|
||||
assert issubclass(script_typeclass, self.__BASE_SCRIPT_TYPECLASS)
|
||||
assert issubclass(script_typeclass, _BASE_SCRIPT_TYPECLASS)
|
||||
self.typeclass_storage[key] = script_typeclass
|
||||
except Exception:
|
||||
logger.log_trace(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue