Fixed a typeclass access bug in @find. Resolves issue 199.

This commit is contained in:
Griatch 2011-10-10 09:14:50 +02:00
parent 8d3817ccd4
commit 70b4b559a5
2 changed files with 9 additions and 8 deletions

View file

@ -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

View file

@ -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):
"""