Make Builders be able to look/search by key+alias in rpsystem.
This commit is contained in:
parent
2d35c71cd1
commit
bbc2f255fc
1 changed files with 23 additions and 14 deletions
|
|
@ -1176,27 +1176,36 @@ class ContribRPObject(DefaultObject):
|
||||||
candidates.append(self)
|
candidates.append(self)
|
||||||
|
|
||||||
# the sdesc-related substitution
|
# the sdesc-related substitution
|
||||||
if use_dbref is None:
|
is_builder = self.locks.check_lockstring(self, "perm(Builders)")
|
||||||
use_dbref = self.locks.check_lockstring(self, "perm(Builders)")
|
use_dbref = is_builder if use_dbref is None else use_dbref
|
||||||
|
search_obj = lambda string: ObjectDB.objects.object_search(string,
|
||||||
|
attribute_name=attribute_name,
|
||||||
|
typeclass=typeclass,
|
||||||
|
candidates=candidates,
|
||||||
|
exact=exact,
|
||||||
|
use_dbref=use_dbref)
|
||||||
|
|
||||||
if candidates:
|
if candidates:
|
||||||
candidates = parse_sdescs_and_recogs(self, candidates,
|
candidates = parse_sdescs_and_recogs(self, candidates,
|
||||||
_PREFIX + searchdata, search_mode=True)
|
_PREFIX + searchdata, search_mode=True)
|
||||||
results = []
|
results = []
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
results.extend(ObjectDB.objects.object_search(candidate.key,
|
# we search by candidate keys here; this allows full error
|
||||||
attribute_name=attribute_name,
|
# management and use of all kwargs - we will use searchdata
|
||||||
typeclass=typeclass,
|
# in eventual error reporting later (not their keys). Doing
|
||||||
candidates=candidates,
|
# it like this e.g. allows for use of the typeclass kwarg
|
||||||
exact=exact,
|
# limiter.
|
||||||
use_dbref=use_dbref))
|
results.extend(search_obj(candidate.key))
|
||||||
|
|
||||||
|
if not results and is_builder:
|
||||||
|
# builders get a chance to search only by key+alias
|
||||||
|
results = search_obj(searchdata)
|
||||||
else:
|
else:
|
||||||
results = ObjectDB.objects.object_search(searchdata,
|
# global searches / #drefs end up here. Global searches are
|
||||||
attribute_name=attribute_name,
|
# only done in code, so is controlled, #dbrefs are turned off
|
||||||
typeclass=typeclass,
|
# for non-Builders.
|
||||||
candidates=candidates,
|
results = search_obj(searchdata)
|
||||||
exact=exact,
|
|
||||||
use_dbref=use_dbref)
|
|
||||||
if quiet:
|
if quiet:
|
||||||
return results
|
return results
|
||||||
return _AT_SEARCH_RESULT(results, self, query=searchdata,
|
return _AT_SEARCH_RESULT(results, self, query=searchdata,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue