From 70b4b559a50745a4ec0ec3544ef4d6f07fc91b49 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 10 Oct 2011 09:14:50 +0200 Subject: [PATCH] Fixed a typeclass access bug in @find. Resolves issue 199. --- src/commands/default/building.py | 8 ++++---- src/server/initial_setup.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 4c8f5ad34a..2c98babbed 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1719,7 +1719,7 @@ class CmdFind(MuxCommand): if not low <= int(result.id) <= high: string += "\n {RNo match found for '%s' within the given dbref limits.{n" % searchstring else: - string += "\n{g %s(%s) - %s{n" % (result.key, result.dbref, result.typeclass) + string += "\n{g %s(%s) - %s{n" % (result.key, result.dbref, result.typeclass.path) else: # Not a player/dbref search but a wider search; build a queryset. @@ -1749,14 +1749,14 @@ class CmdFind(MuxCommand): restrictions = ", %s" % (",".join(self.switches)) if nresults: # convert result to typeclasses. - results = [result.typeclass(result) for result in results] + results = [result.typeclass for result in results] if nresults > 1: string = "{w%i Matches{n(#%i-#%i%s):" % (nresults, low, high, restrictions) for res in results: - string += "\n {g%s(%s) - %s{n" % (res.key, res.dbref, res.typeclass) + string += "\n {g%s(%s) - %s{n" % (res.key, res.dbref, res.path) else: string = "{wOne Match{n(#%i-#%i%s):" % (low, high, restrictions) - string += "\n {g%s(%s) - %s{n" % (results[0].key, results[0].dbref, results[0].typeclass) + string += "\n {g%s(%s) - %s{n" % (results[0].key, results[0].dbref, results[0].path) else: string = "{wMatch{n(#%i-#%i%s):" % (low, high, restrictions) string += "\n {RNo matches found for '%s'{n" % searchstring diff --git a/src/server/initial_setup.py b/src/server/initial_setup.py index 0b361ab765..0000d30989 100644 --- a/src/server/initial_setup.py +++ b/src/server/initial_setup.py @@ -181,8 +181,10 @@ def create_admin_media_links(): def at_initial_setup(): """ - Custom hook for users to overload some or all parts of the initial setup. Called very - last in the sequence. It tries to import and run a module + Custom hook for users to overload some or all parts of the initial + setup. Called very last in the sequence. It tries to import and + run a module settings.AT_INITIAL_SETUP_HOOK_MODULE and will fail + silently if this does not exist or fails to load. """ try: mod = __import__(settings.AT_INITIAL_SETUP_HOOK_MODULE, fromlist=[None]) @@ -190,8 +192,7 @@ def at_initial_setup(): return print _(" Running at_initial_setup() hook.") if mod.__dict__.get("at_initial_setup", None): - mod.at_initial_setup() - + mod.at_initial_setup() def handle_setup(last_step): """