diff --git a/CHANGELOG.md b/CHANGELOG.md index 22e14ae163..d169657c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ - Spawning an object using a prototype will automatically assign a new tag to it, named the same as the `prototype_key` and with the category `from_prototype`. - The spawn command was extended to accept a full prototype on one line. -- The spawn command got the /save switch to save the defined prototype and its key. +- The spawn command got the /save switch to save the defined prototype and its key - The command spawn/menu will now start an OLC (OnLine Creation) menu to load/save/edit/spawn prototypes. - The OLC allows for updating all objects previously created using a given prototype with any changes done. @@ -53,6 +53,16 @@ - Refactoring of webclient structure. +### Locks + +- New function `evennia.locks.lockhandler.check_lockstring`. This allows for checking an object + against an arbitrary lockstring without needing the lock to be stored on an object first. +- New function `evennia.locks.lockhandler.validate_lockstring` allows for stand-alone validation + of a lockstring. +- New function `evennia.locks.lockhandler.get_all_lockfuncs` gives a dict {"name": lockfunc} for + all available lock funcs. This is useful for dynamic listings. + + ### Utils - Added new `columnize` function for easily splitting text into multiple columns. At this point it @@ -62,6 +72,8 @@ This removes a problem with the original `textwrap.dedent` which will only dedent to the least indented part of a text. - Added `exit_cmd` to EvMore pager, to allow for calling a command (e.g. 'look') when leaving the pager. +- `get_all_typeclasses` will return dict `{"path": typeclass, ...}` for all typeclasses available + in the system. This is used by the new `@typeclass/list` subcommand (useful for builders etc). ### General diff --git a/evennia/locks/lockhandler.py b/evennia/locks/lockhandler.py index 19bfbec707..2338b18667 100644 --- a/evennia/locks/lockhandler.py +++ b/evennia/locks/lockhandler.py @@ -114,6 +114,9 @@ from django.utils.translation import ugettext as _ __all__ = ("LockHandler", "LockException") WARNING_LOG = settings.LOCKWARNING_LOG_FILE +_LOCK_HANDLER = None + + # # Exception class. This will be raised @@ -614,8 +617,6 @@ class LockHandler(object): class _ObjDummy: lock_storage = '' -_LOCK_HANDLER = LockHandler(_ObjDummy()) - def check_lockstring(self, accessing_obj, lockstring, no_superuser_bypass=False, default=False, access_type=None): @@ -642,6 +643,9 @@ def check_lockstring(self, accessing_obj, lockstring, no_superuser_bypass=False, access (bool): If check is passed or not. """ + global _LOCKHANDLER + if not _LOCKHANDLER: + _LOCKHANDLER = LockHandler(_ObjDummy()) return _LOCK_HANDLER.check_lockstring( accessing_obj, lockstring, no_superuser_bypass=no_superuser_bypass, default=default, access_type=access_type) @@ -660,6 +664,9 @@ def validate_lockstring(lockstring): if no error was found. """ + global _LOCKHANDLER + if not _LOCKHANDLER: + _LOCKHANDLER = LockHandler(_ObjDummy()) return _LOCK_HANDLER.validate(lockstring)