From 692266d1bb91556f019364117b4872549407ccf1 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Jan 2019 12:56:43 +0100 Subject: [PATCH 1/5] Clarifying use_dbref docstring --- evennia/objects/objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 27d8147999..5a4282a49d 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -388,8 +388,8 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): nofound_string (str): optional custom string for not-found error message. multimatch_string (str): optional custom string for multimatch error header. use_dbref (bool or None, optional): if True/False, active/deactivate the use of - #dbref as valid global search arguments. If None, check against a permission - ('Builder' by default). + #dbref as valid global search arguments. If None (default), activate this ability + only if `self` has the permission 'Builder'. Returns: match (Object, None or list): will return an Object/None if `quiet=False`, From 2bea75c27d2578c552147677e1809e9d82644001 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Jan 2019 14:35:44 +0100 Subject: [PATCH 2/5] Further clarifications in search docstring --- evennia/objects/objects.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 5a4282a49d..e4b0b80639 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -387,9 +387,11 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): caller's contents (inventory). nofound_string (str): optional custom string for not-found error message. multimatch_string (str): optional custom string for multimatch error header. - use_dbref (bool or None, optional): if True/False, active/deactivate the use of - #dbref as valid global search arguments. If None (default), activate this ability - only if `self` has the permission 'Builder'. + use_dbref (bool or None, optional): If `True`, allow to enter e.g. a query "#123" + to find an object (globally) by its database-id 123. If `False`, the string "#123" + will be treated like a normal string. If `None` (default), the ability to query by + #dbref is turned on if `self` has the permission 'Builder' and is turned off + otherwise. Returns: match (Object, None or list): will return an Object/None if `quiet=False`, From 855e7f32b07a5c129a3849058e81d3dc18fe7565 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Jan 2019 19:36:24 +0100 Subject: [PATCH 3/5] Re-add missing fix for candidates removed in refactor Resolves #1763. --- evennia/objects/objects.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 714a5e4902..aadb7a7ea7 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -432,8 +432,8 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): # only allow exact matching if searching the entire database # or unique #dbrefs exact = True - else: - # TODO: write code...if candidates is None: + + elif candidates is None: # no custom candidates given - get them automatically if location: # location(s) were given @@ -1950,13 +1950,13 @@ class DefaultCharacter(DefaultObject): if len(account.characters) >= settings.MAX_NR_CHARACTERS: errors.append("There are too many characters associated with this account.") return obj, errors - + # Create the Character obj = create.create_object(**kwargs) # Record creator id and creation IP if ip: obj.db.creator_ip = ip - if account: + if account: obj.db.creator_id = account.id if obj not in account.characters: account.db._playable_characters.append(obj) @@ -1973,7 +1973,7 @@ class DefaultCharacter(DefaultObject): # If no description is set, set a default description if description or not obj.db.desc: obj.db.desc = description if description else "This is a character." - + except Exception as e: errors.append("An error occurred while creating this '%s' object." % key) logger.log_err(e) From b45cdcf8c2f35451f4e135970bdcab5f69e55622 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Jan 2019 19:51:26 +0100 Subject: [PATCH 4/5] Fix nix traceback. Resolves #1761. --- evennia/commands/default/general.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/evennia/commands/default/general.py b/evennia/commands/default/general.py index 85fb1b4dd4..8b15e7e3f7 100644 --- a/evennia/commands/default/general.py +++ b/evennia/commands/default/general.py @@ -211,7 +211,9 @@ class CmdNick(COMMAND_DEFAULT_CLASS): if not specified_nicktype: nicktypes = ("object", "account", "inputline") for nicktype in nicktypes: - nicks = utils.make_iter(caller.nicks.get(category=nicktype, return_obj=True)) + nicks = [nick for nick in + utils.make_iter(caller.nicks.get(category=nicktype, return_obj=True)) + if nick] for nick in nicks: _, _, nick, repl = nick.value if nick.startswith(self.lhs): From f7857d6a2cdad77528b53cc812f1af4aa1d735d7 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Jan 2019 19:52:55 +0100 Subject: [PATCH 5/5] Fix traceback in nick cmd. Resolves #1761 --- evennia/commands/default/general.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/evennia/commands/default/general.py b/evennia/commands/default/general.py index 85fb1b4dd4..8b15e7e3f7 100644 --- a/evennia/commands/default/general.py +++ b/evennia/commands/default/general.py @@ -211,7 +211,9 @@ class CmdNick(COMMAND_DEFAULT_CLASS): if not specified_nicktype: nicktypes = ("object", "account", "inputline") for nicktype in nicktypes: - nicks = utils.make_iter(caller.nicks.get(category=nicktype, return_obj=True)) + nicks = [nick for nick in + utils.make_iter(caller.nicks.get(category=nicktype, return_obj=True)) + if nick] for nick in nicks: _, _, nick, repl = nick.value if nick.startswith(self.lhs):