From 263a3f79d649ea9fc6014eb193e8dfecce0f2754 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 31 Mar 2018 12:40:57 +0200 Subject: [PATCH 1/7] Fix of output handling in msg() when text is None --- evennia/accounts/accounts.py | 16 +++++++++------- evennia/objects/objects.py | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 48d03d8dc8..fe7693cce0 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -421,17 +421,19 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)): kwargs["options"] = options - if not (isinstance(text, basestring) or isinstance(text, tuple)): - # sanitize text before sending across the wire - try: - text = to_str(text, force_string=True) - except Exception: - text = repr(text) + if text is not None: + if not (isinstance(text, basestring) or isinstance(text, tuple)): + # sanitize text before sending across the wire + try: + text = to_str(text, force_string=True) + except Exception: + text = repr(text) + kwargs['text'] = text # session relay sessions = make_iter(session) if session else self.sessions.all() for session in sessions: - session.data_out(text=text, **kwargs) + session.data_out(**kwargs) def execute_cmd(self, raw_string, session=None, **kwargs): """ diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index f583570707..8cdf546706 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -535,17 +535,19 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): except Exception: logger.log_trace() - if not (isinstance(text, basestring) or isinstance(text, tuple)): - # sanitize text before sending across the wire - try: - text = to_str(text, force_string=True) - except Exception: - text = repr(text) + if text is not None: + if not (isinstance(text, basestring) or isinstance(text, tuple)): + # sanitize text before sending across the wire + try: + text = to_str(text, force_string=True) + except Exception: + text = repr(text) + kwargs['text'] = text # relay to session(s) sessions = make_iter(session) if session else self.sessions.all() for session in sessions: - session.data_out(text=text, **kwargs) + session.data_out(**kwargs) def for_contents(self, func, exclude=None, **kwargs): From 1cf408e653484506114b935d16583f600d537420 Mon Sep 17 00:00:00 2001 From: CloudKeeper1 Date: Sat, 14 Apr 2018 00:23:52 +1000 Subject: [PATCH 2/7] Wrong symbol on line 499 Wrong symbol on line 499 --- evennia/commands/default/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/commands/default/general.py b/evennia/commands/default/general.py index 2f4c51a227..f9634ed675 100644 --- a/evennia/commands/default/general.py +++ b/evennia/commands/default/general.py @@ -496,7 +496,7 @@ class CmdWhisper(COMMAND_DEFAULT_CLASS): Usage: whisper = - whisper , = , = Talk privately to one or more characters in your current location, without others in the room being informed. From 2f1b0de92162b2cf75e519ec815d8abd391f7216 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Mon, 16 Apr 2018 18:41:02 +0530 Subject: [PATCH 3/7] Update rpsystem.py --- evennia/contrib/rpsystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/contrib/rpsystem.py b/evennia/contrib/rpsystem.py index a56d2de731..efba0fe7fd 100644 --- a/evennia/contrib/rpsystem.py +++ b/evennia/contrib/rpsystem.py @@ -1088,7 +1088,7 @@ class CmdMask(RPCommand): if self.cmdstring == "mask": # wear a mask if not self.args: - caller.msg("Usage: (un)wearmask sdesc") + caller.msg("Usage: (un)mask sdesc") return if caller.db.unmasked_sdesc: caller.msg("You are already wearing a mask.") @@ -1111,7 +1111,7 @@ class CmdMask(RPCommand): del caller.db.unmasked_sdesc caller.locks.remove("enable_recog") caller.sdesc.add(old_sdesc) - caller.msg("You remove your mask and is again '%s'." % old_sdesc) + caller.msg("You remove your mask and are again '%s'." % old_sdesc) class RPSystemCmdSet(CmdSet): From 4bacab7b9555df34f27043e368bf6a2f63a23d84 Mon Sep 17 00:00:00 2001 From: Rachel Blackman Date: Wed, 24 Oct 2018 10:41:58 -0700 Subject: [PATCH 4/7] Add new --initmissing switch to prepare game images checked out of git --- evennia/server/evennia_launcher.py | 37 +++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index ef6bf61055..50c355dc58 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -222,6 +222,19 @@ RECREATED_SETTINGS = \ their accounts with their old passwords. """ +ERROR_INITMISSING = \ + """ + ERROR: 'evennia --initmissing' must be called from the root of + your game directory, since it tries to create any missing files + in the server/ subfolder. + """ + +RECREATED_MISSING = \ + """ + (Re)created any missing directories or files. Evennia should + be ready to run now! + """ + ERROR_DATABASE = \ """ ERROR: Your database does not seem to be set up correctly. @@ -1331,7 +1344,10 @@ def create_settings_file(init=True, secret_settings=False): else: print("Reset the settings file.") - default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "settings.py") + if secret_settings: + default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "secret_settings.py") + else: + default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "settings.py") shutil.copy(default_settings_path, settings_path) with open(settings_path, 'r') as f: @@ -1914,6 +1930,10 @@ def main(): '--initsettings', action='store_true', dest="initsettings", default=False, help="create a new, empty settings file as\n gamedir/server/conf/settings.py") + parser.add_argument( + '--initmissing', action='store_true', dest="initmissing", + default=False, + help="checks for missing secret_settings or server logs\n directory, and adds them if needed") parser.add_argument( '--profiler', action='store_true', dest='profiler', default=False, help="start given server component under the Python profiler") @@ -1987,6 +2007,21 @@ def main(): print(ERROR_INITSETTINGS) sys.exit() + if args.initmissing: + try: + log_path = os.path.join(SERVERDIR, "logs") + if not os.path.exists(log_path): + os.makedirs(log_path) + + settings_path = os.path.join(CONFDIR, "secret_settings.py") + if not os.path.exists(settings_path): + create_settings_file(init=False, secret_settings=True) + + print(RECREATED_MISSING) + except IOError: + print(ERROR_INITMISSING) + sys.exit() + if args.tail_log: # set up for tailing the log files global NO_REACTOR_STOP From afb5af8c6d985955dc7a12fe2e0f313684af3069 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 26 Oct 2018 20:07:05 +0200 Subject: [PATCH 5/7] Give default permissions to spawn/edit prototypes. Resolves #1687. --- evennia/commands/default/building.py | 3 ++- evennia/prototypes/prototypes.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 503a9c15e9..7b77ae0faa 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -3091,7 +3091,8 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): return # we have a prototype, check access prototype = prototypes[0] - if not caller.locks.check_lockstring(caller, prototype.get('prototype_locks', ''), access_type='spawn'): + if not caller.locks.check_lockstring( + caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True): caller.msg("You don't have access to use this prototype.") return diff --git a/evennia/prototypes/prototypes.py b/evennia/prototypes/prototypes.py index fc8edb55ab..833316cf59 100644 --- a/evennia/prototypes/prototypes.py +++ b/evennia/prototypes/prototypes.py @@ -258,7 +258,7 @@ def delete_prototype(prototype_key, caller=None): stored_prototype = stored_prototype[0] if caller: if not stored_prototype.access(caller, 'edit'): - raise PermissionError("{} does not have permission to " + raise PermissionError("{} needs explicit 'edit' permissions to " "delete prototype {}.".format(caller, prototype_key)) stored_prototype.delete() return True @@ -374,14 +374,14 @@ def list_prototypes(caller, key=None, tags=None, show_non_use=False, show_non_ed display_tuples = [] for prototype in sorted(prototypes, key=lambda d: d.get('prototype_key', '')): lock_use = caller.locks.check_lockstring( - caller, prototype.get('prototype_locks', ''), access_type='spawn') + caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True) if not show_non_use and not lock_use: continue if prototype.get('prototype_key', '') in _MODULE_PROTOTYPES: lock_edit = False else: lock_edit = caller.locks.check_lockstring( - caller, prototype.get('prototype_locks', ''), access_type='edit') + caller, prototype.get('prototype_locks', ''), access_type='edit', default=True) if not show_non_edit and not lock_edit: continue ptags = [] @@ -713,7 +713,8 @@ def check_permission(prototype_key, action, default=True): lockstring = prototype.get("prototype_locks") if lockstring: - return check_lockstring(None, lockstring, default=default, access_type=action) + return check_lockstring(None, lockstring, + default=default, access_type=action) return default From 8709237e7d7e187e1697700e0011b8b23ac0aa45 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 26 Oct 2018 20:38:33 +0200 Subject: [PATCH 6/7] Add default README to logs directory to make it possible to keep in git --- evennia/game_template/server/logs/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 evennia/game_template/server/logs/README.md diff --git a/evennia/game_template/server/logs/README.md b/evennia/game_template/server/logs/README.md new file mode 100644 index 0000000000..35ad999cd5 --- /dev/null +++ b/evennia/game_template/server/logs/README.md @@ -0,0 +1,15 @@ +This directory contains Evennia's log files. The existence of this README.md file is also necessary +to correctly include the log directory in git (since log files are ignored by git and you can't +commit an empty directory). + +- `server.log` - log file from the game Server. +- `portal.log` - log file from Portal proxy (internet facing) + +Usually these logs are viewed together with `evennia -l`. They are also rotated every week so as not +to be too big. Older log names will have a name appended by `_month_date`. + +- `lockwarnings.log` - warnings from the lock system. +- `http_requests.log` - this will generally be empty unless turning on debugging inside the server. + +- `channel_.log` - these are channel logs for the in-game channels They are also used + by the `/history` flag in-game to get the latest message history. From e64950190fad7236073d9d878dbd1801a6a3fd3b Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 26 Oct 2018 20:39:28 +0200 Subject: [PATCH 7/7] Remove default server.log from game template --- evennia/game_template/server/logs/server.log | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 evennia/game_template/server/logs/server.log diff --git a/evennia/game_template/server/logs/server.log b/evennia/game_template/server/logs/server.log deleted file mode 100644 index e69de29bb2..0000000000