diff --git a/CHANGELOG.md b/CHANGELOG.md index 7450063360..5ba5309eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,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 62a00f090f..dc91c3990e 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -583,12 +583,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 16fb9c3915..7d3e517c50 100644 --- a/evennia/utils/inlinefuncs.py +++ b/evennia/utils/inlinefuncs.py @@ -67,6 +67,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 @@ -276,12 +279,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"(?