From c37dde248ec47dda75236820ea1b9b93030a6b41 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 10 Dec 2023 19:59:24 +0100 Subject: [PATCH] Update CHANGELOG, some refining of docs --- CHANGELOG.md | 15 ++++++++++++++- docs/source/Coding/Changelog.md | 15 ++++++++++++++- docs/source/Setup/Settings-Default.md | 10 ++++++++++ evennia/accounts/accounts.py | 19 ++++++------------- evennia/objects/objects.py | 10 ++++++---- evennia/server/serversession.py | 11 +++-------- evennia/settings_default.py | 4 ++-- evennia/utils/evmore.py | 9 ++++----- 8 files changed, 59 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f531552d81..363ea689b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,10 @@ tools `evennia.utils.match_ip` and `utils.ip_from_request` to help. (Volund) - [Feature][pull3349]: Refactored almost all default commands to use `Command.msg` over the `command.caller.msg` direct call (more flexible) (Volund) +- [Feature][pull3346]: Refactor cmdhandler to be more extensible; make cmd merge + a bit more deterministic (Volund) +- [Feature][pull3348]: Make Fallback AJAX web client more customizable (same as + the websocket client) (Volund) - Fix (Backwards incompatible): Change `settings._TEST_ENVIRONMENT` to `settings.TEST_ENVIRONMENT` to address issues during refactored startup sequence. - [Fix][pull3197]: Make sure Global scripts only start in one place, @@ -56,7 +60,12 @@ (jaborsh) - [fix][issue3331]: Made XYZGrid query zcoords in a case-insensitive manner. - [Fix][pull3322]: Fix `BaseOption.display` to always return a string. -- Docs: Lots of Typo and other fixes (iLPdev, InspectorCaracal, jaborsh) +- [Fix][pull3358]: Fix so Portal resets `server_restart_mode` flag when having + successfully reconnected to the Server after a restart. (InspectorCaracal) +- [Fix][pull3359]: Fix gendersub contrib to use proper pronoun when referencing + other objects than oneself (InspectorCaracal) +- Docs & docstrings: Lots of Typo and other fixes (iLPdev, InspectorCaracal, jaborsh, + HouseOfPoe etc) - Beginner tutorial: Cleanup and starting earlier with explaining how to add to the default cmdsets. @@ -81,6 +90,10 @@ [pull3344]: https://github.com/evennia/evennia/pull/3344 [pull3349]: https://github.com/evennia/evennia/pull/3349 [pull3350]: https://github.com/evennia/evennia/pull/3350 +[pull3346]: https://github.com/evennia/evennia/pull/3346 +[pull3348]: https://github.com/evennia/evennia/pull/3348 +[pull3358]: https://github.com/evennia/evennia/pull/3358 +[pull3359]: https://github.com/evennia/evennia/pull/3359 [issue3272]: https://github.com/evennia/evennia/issues/3272 [issue3273]: https://github.com/evennia/evennia/issues/3273 [issue3308]: https://github.com/evennia/evennia/issues/3307 diff --git a/docs/source/Coding/Changelog.md b/docs/source/Coding/Changelog.md index f531552d81..363ea689b6 100644 --- a/docs/source/Coding/Changelog.md +++ b/docs/source/Coding/Changelog.md @@ -38,6 +38,10 @@ tools `evennia.utils.match_ip` and `utils.ip_from_request` to help. (Volund) - [Feature][pull3349]: Refactored almost all default commands to use `Command.msg` over the `command.caller.msg` direct call (more flexible) (Volund) +- [Feature][pull3346]: Refactor cmdhandler to be more extensible; make cmd merge + a bit more deterministic (Volund) +- [Feature][pull3348]: Make Fallback AJAX web client more customizable (same as + the websocket client) (Volund) - Fix (Backwards incompatible): Change `settings._TEST_ENVIRONMENT` to `settings.TEST_ENVIRONMENT` to address issues during refactored startup sequence. - [Fix][pull3197]: Make sure Global scripts only start in one place, @@ -56,7 +60,12 @@ (jaborsh) - [fix][issue3331]: Made XYZGrid query zcoords in a case-insensitive manner. - [Fix][pull3322]: Fix `BaseOption.display` to always return a string. -- Docs: Lots of Typo and other fixes (iLPdev, InspectorCaracal, jaborsh) +- [Fix][pull3358]: Fix so Portal resets `server_restart_mode` flag when having + successfully reconnected to the Server after a restart. (InspectorCaracal) +- [Fix][pull3359]: Fix gendersub contrib to use proper pronoun when referencing + other objects than oneself (InspectorCaracal) +- Docs & docstrings: Lots of Typo and other fixes (iLPdev, InspectorCaracal, jaborsh, + HouseOfPoe etc) - Beginner tutorial: Cleanup and starting earlier with explaining how to add to the default cmdsets. @@ -81,6 +90,10 @@ [pull3344]: https://github.com/evennia/evennia/pull/3344 [pull3349]: https://github.com/evennia/evennia/pull/3349 [pull3350]: https://github.com/evennia/evennia/pull/3350 +[pull3346]: https://github.com/evennia/evennia/pull/3346 +[pull3348]: https://github.com/evennia/evennia/pull/3348 +[pull3358]: https://github.com/evennia/evennia/pull/3358 +[pull3359]: https://github.com/evennia/evennia/pull/3359 [issue3272]: https://github.com/evennia/evennia/issues/3272 [issue3273]: https://github.com/evennia/evennia/issues/3273 [issue3308]: https://github.com/evennia/evennia/issues/3307 diff --git a/docs/source/Setup/Settings-Default.md b/docs/source/Setup/Settings-Default.md index 6f9de3fd93..95935f0f06 100644 --- a/docs/source/Setup/Settings-Default.md +++ b/docs/source/Setup/Settings-Default.md @@ -1196,6 +1196,16 @@ SSL_PROTOCOL_CLASS = "evennia.server.portal.ssl.SSLProtocol" # for all webclient connections. WEBSOCKET_PROTOCOL_CLASS = "evennia.server.portal.webclient.WebSocketClient" +# Ajax Web Client classes. Evennia uses AJAX as a fallback for the webclient by +# default. AJAX may in general be more useful for mobile clients as it's +# resilient to IP address changes. + +# The Ajax Client Class is used to manage all AJAX sessions. +AJAX_CLIENT_CLASS = "evennia.server.portal.webclient.ajax.AjaxWebClient" + +# Ajax Protocol Class is used for all AJAX client connections. +AJAX_PROTOCOL_CLASS = "evennia.server.portal.webclient_ajax.AjaxWebClientSession" + # Protocol for the SSH interface. This inherits from BASE_SESSION_CLASS. SSH_PROTOCOL_CLASS = "evennia.server.portal.ssh.SshProtocol" diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 6df9f80244..e890724d1c 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -15,14 +15,13 @@ import time import typing from random import getrandbits +import evennia from django.conf import settings from django.contrib.auth import authenticate, password_validation from django.core.exceptions import ImproperlyConfigured, ValidationError from django.utils import timezone from django.utils.module_loading import import_string from django.utils.translation import gettext as _ - -import evennia from evennia.accounts.manager import AccountManager from evennia.accounts.models import AccountDB from evennia.commands.cmdsethandler import CmdSetHandler @@ -41,13 +40,7 @@ from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler from evennia.typeclasses.models import TypeclassBase from evennia.utils import class_from_module, create, logger from evennia.utils.optionhandler import OptionHandler -from evennia.utils.utils import ( - is_iter, - lazy_property, - make_iter, - to_str, - variable_from_module, -) +from evennia.utils.utils import is_iter, lazy_property, make_iter, to_str, variable_from_module __all__ = ("DefaultAccount", "DefaultGuest") @@ -916,8 +909,8 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase): self.db._last_puppet = character character.locks.add( - f"puppet:id({character.id}) or pid({self.id}) or perm(Developer) or pperm(Developer);delete:id({self.id}) or" - " perm(Admin)" + f"puppet:id({character.id}) or pid({self.id}) or perm(Developer) or" + f" pperm(Developer);delete:id({self.id}) or perm(Admin)" ) logger.log_sec( @@ -1540,8 +1533,8 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase): have no cmdsets. Keyword Args: - caller (obj): The object requesting the cmdsets. - current (cmdset): The current merged cmdset. + caller (Object, Account or Session): The object requesting the cmdsets. + current (CmdSet): The current merged cmdset. force_init (bool): If `True`, force a re-build of the cmdset. (seems unused) **kwargs: Arbitrary input for overloads. diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index d0af66fece..54b0d2bfbf 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -1623,8 +1623,8 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase): have no cmdsets. Keyword Args: - caller (obj): The object requesting the cmdsets. - current (cmdset): The current merged cmdset. + caller (Object, Account or Session): The object requesting the cmdsets. + current (CmdSet): The current merged cmdset. force_init (bool): If `True`, force a re-build of the cmdset. (seems unused) **kwargs: Arbitrary input for overloads. @@ -3166,8 +3166,10 @@ class DefaultExit(DefaultObject): has no cmdsets. Keyword Args: - force_init (bool): If `True`, force a re-build of the cmdset - (for example to update aliases). + caller (Object, Account or Session): The object requesting the cmdsets. + current (CmdSet): The current merged cmdset. + force_init (bool): If `True`, force a re-build of the cmdset + (for example to update aliases). """ diff --git a/evennia/server/serversession.py b/evennia/server/serversession.py index 09488303b1..1bff150ea7 100644 --- a/evennia/server/serversession.py +++ b/evennia/server/serversession.py @@ -10,15 +10,10 @@ import time from django.conf import settings from django.utils import timezone - from evennia.commands.cmdsethandler import CmdSetHandler from evennia.comms.models import ChannelDB from evennia.scripts.monitorhandler import MONITOR_HANDLER -from evennia.typeclasses.attributes import ( - AttributeHandler, - DbHolder, - InMemoryAttributeBackend, -) +from evennia.typeclasses.attributes import AttributeHandler, DbHolder, InMemoryAttributeBackend from evennia.utils import logger from evennia.utils.utils import class_from_module, lazy_property, make_iter @@ -408,8 +403,8 @@ class ServerSession(_BASE_SESSION_CLASS): have no cmdsets. Keyword Args: - caller (obj): The object requesting the cmdsets. - current (cmdset): The current merged cmdset. + caller (Object, Account or Session): The object requesting the cmdsets. + current (CmdSet): The current merged cmdset. force_init (bool): If `True`, force a re-build of the cmdset. (seems unused) **kwargs: Arbitrary input for overloads. diff --git a/evennia/settings_default.py b/evennia/settings_default.py index 76e020c418..71d493ab8b 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -1182,10 +1182,10 @@ WEBSOCKET_PROTOCOL_CLASS = "evennia.server.portal.webclient.WebSocketClient" # resilient to IP address changes. # The Ajax Client Class is used to manage all AJAX sessions. -AJAX_CLIENT_CLASS = "evennia.server.webclient.ajax.AjaxWebClient" +AJAX_CLIENT_CLASS = "evennia.server.portal.webclient.ajax.AjaxWebClient" # Ajax Protocol Class is used for all AJAX client connections. -AJAX_PROTOCOL_CLASS = "evennia.server.webclient_ajax.AjaxWebClientSession" +AJAX_PROTOCOL_CLASS = "evennia.server.portal.webclient_ajax.AjaxWebClientSession" # Protocol for the SSH interface. This inherits from BASE_SESSION_CLASS. SSH_PROTOCOL_CLASS = "evennia.server.portal.ssh.SshProtocol" diff --git a/evennia/utils/evmore.py b/evennia/utils/evmore.py index 48356ac7da..80c0ebe487 100644 --- a/evennia/utils/evmore.py +++ b/evennia/utils/evmore.py @@ -36,12 +36,11 @@ the `caller.msg()` construct every time the page is updated. ---- """ +import evennia from django.conf import settings from django.core.paginator import Paginator from django.db.models.query import QuerySet from django.utils.translation import gettext as _ - -import evennia from evennia.commands import cmdhandler from evennia.commands.cmdset import CmdSet from evennia.commands.command import Command @@ -194,9 +193,9 @@ class EvMore(object): the evmore commands will be available when this is run). kwargs (any, optional): These will be passed on to the `caller.msg` method. Notably, one can pass additional outputfuncs this way. There is one special kwarg: - - text_kwargs - extra kwargs to pass with the text outputfunc, e.g. - `text_kwargs={"type": "help"} would result to each page being sent - to `msg` as `text=(pagetxt, {"type": "help"})`. + - `text_kwargs` - extra kwargs to pass with the text outputfunc, e.g. + `text_kwargs={"type": "help"}` would result to each page being sent + to `msg` as `text=(pagetxt, {"type": "help"})`. Examples: