From 8e10683f644e9bc267c6d824c205773567d2ae4f Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 31 Mar 2018 12:40:57 +0200 Subject: [PATCH 1/4] 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 319ed6db8d5256fbfe273858c1e36c05f0d793a4 Mon Sep 17 00:00:00 2001 From: CloudKeeper1 Date: Sat, 14 Apr 2018 00:23:52 +1000 Subject: [PATCH 2/4] 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 49cad235f26e81bfc08971ebe26f59629c087c47 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Mon, 16 Apr 2018 18:41:02 +0530 Subject: [PATCH 3/4] 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 2348bc1be132b25b41da2e5b907f775b77c1a054 Mon Sep 17 00:00:00 2001 From: Rachel Blackman Date: Wed, 24 Oct 2018 10:41:58 -0700 Subject: [PATCH 4/4] 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