diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3cdaee79..ff06b0eccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ without arguments starts a full interactive Python console. - Make CmdGet/Drop/Give give proper error if `obj.move_to` returns `False`. - Make `Object/Room/Exit.create`'s `account` argument optional. If not given, will set perms to that of the object itself (along with normal Admin/Dev permission). +- Make `INLINEFUNC_STACK_MAXSIZE` default visible in `settings_default.py`. ## Evennia 0.9 (2018-2019) diff --git a/evennia/settings_default.py b/evennia/settings_default.py index 7a3b1d6fa9..148680bf64 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -593,12 +593,15 @@ TIME_IGNORE_DOWNTIMES = False # session-aware text formatting and manipulation on the fly. If # disabled, such inline functions will not be parsed. INLINEFUNC_ENABLED = False +# This defined how deeply nested inlinefuncs can be. Set to <=0 to +# disable (not recommended, this is a safeguard against infinite loops). +INLINEFUNC_STACK_MAXSIZE = 20 # Only functions defined globally (and not starting with '_') in # these modules will be considered valid inlinefuncs. The list # is loaded from left-to-right, same-named functions will overload INLINEFUNC_MODULES = ["evennia.utils.inlinefuncs", "server.conf.inlinefuncs"] -# Module holding handlers for OLCFuncs. These allow for embedding -# functional code in prototypes +# Module holding handlers for ProtFuncs. These allow for embedding +# functional code in prototypes and has the same syntax as inlinefuncs. PROTOTYPEFUNC_MODULES = ["evennia.utils.prototypefuncs", "server.conf.prototypefuncs"] ###################################################################### diff --git a/evennia/utils/inlinefuncs.py b/evennia/utils/inlinefuncs.py index eeb8f1963c..84b45aa0eb 100644 --- a/evennia/utils/inlinefuncs.py +++ b/evennia/utils/inlinefuncs.py @@ -70,6 +70,9 @@ from django.conf import settings from evennia.utils import utils, logger +# The stack size is a security measure. Set to <=0 to disable. +_STACK_MAXSIZE = settings.INLINEFUNC_STACK_MAXSIZE + # example/testing inline functions @@ -279,12 +282,6 @@ for module in utils.make_iter(settings.INLINEFUNC_MODULES): raise -# The stack size is a security measure. Set to <=0 to disable. -try: - _STACK_MAXSIZE = settings.INLINEFUNC_STACK_MAXSIZE -except AttributeError: - _STACK_MAXSIZE = 20 - # regex definitions _RE_STARTTOKEN = re.compile(r"(?