Some expansion of the search() docstring

This commit is contained in:
Griatch 2015-02-10 19:18:23 +01:00
parent d4b92c6e42
commit c38c9e2f38

View file

@ -328,8 +328,7 @@ class DefaultObject(ObjectDB):
objects in self's current location or inventory is searched. objects in self's current location or inventory is searched.
Note: to find Players, use eg. ev.player_search. Note: to find Players, use eg. ev.player_search.
Inputs: Args:
searchdata (str or obj): Primary search criterion. Will be matched searchdata (str or obj): Primary search criterion. Will be matched
against object.key (with object.aliases second) unless against object.key (with object.aliases second) unless
the keyword attribute_name specifies otherwise. the keyword attribute_name specifies otherwise.
@ -357,31 +356,29 @@ class DefaultObject(ObjectDB):
equal to searchdata. A special use is to search for equal to searchdata. A special use is to search for
"key" here if you want to do a key-search without "key" here if you want to do a key-search without
including aliases. including aliases.
quiet (bool) - don't display default error messages - this tells the quiet (bool): don't display default error messages - this tells the
search method that the user wants to handle all errors search method that the user wants to handle all errors
themselves. It also changes the return value type, see themselves. It also changes the return value type, see
below. below.
exact (bool) - if unset (default) - prefers to match to beginning of exact (bool): if unset (default) - prefers to match to beginning of
string rather than not matching at all. If set, requires string rather than not matching at all. If set, requires
exact mathing of entire string. exact mathing of entire string.
candidates (list of objects) - this is an optional custom list of objects candidates (list of objects): this is an optional custom list of objects
to search (filter) between. It is ignored if global_search to search (filter) between. It is ignored if global_search
is given. If not set, this list will automatically be defined is given. If not set, this list will automatically be defined
to include the location, the contents of location and the to include the location, the contents of location and the
caller's contents (inventory). caller's contents (inventory).
nofound_string - optional custom string for not-found error message. nofound_string (str): optional custom string for not-found error message
multimatch_string - optional custom string for multimatch error header multimatch_string (str): optional custom string for multimatch error header
Returns: Returns:
quiet=False (default): match (Object, None or list): will return an Object/None if quiet=False,
no match or multimatch: otherwise it will return a list of 0, 1 or more matches.
auto-echoes errors to self.msg, then returns None
(results are handled by settings.SEARCH_AT_RESULT Notes:
and settings.SEARCH_AT_MULTIMATCH_INPUT) If quiet=False, error messages will be handled by settings.SEARCH_AT_RESULT
match: and echoed automatically (on error, return will be None). If quiet=True, the
a unique object match error messaging is assumed to be handled by the caller.
quiet=True:
returns a list of 0, 1 or more matches
""" """
is_string = isinstance(searchdata, basestring) is_string = isinstance(searchdata, basestring)