Updated commands to use the new objectdb.search API.

This commit is contained in:
Griatch 2013-05-11 23:22:02 +02:00
parent 218e4a149c
commit 78e7346962
11 changed files with 97 additions and 84 deletions

View file

@ -39,8 +39,13 @@ from src.commands import cmdhandler
from src.utils import logger, utils
from src.utils.utils import inherits_from, make_iter
from django.utils.translation import ugettext as _
__all__ = ("PlayerAttribute", "PlayerNick", "PlayerDB")
_ME = _("me")
_SELF = _("self")
_SESSIONS = None
_AT_SEARCH_RESULT = utils.variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1))
_MULTISESSION_MODE = settings.MULTISESSION_MODE
@ -556,6 +561,10 @@ class PlayerDB(TypedObject):
Extra keywords are ignored, but are allowed in call in order to make API more consistent
with objects.models.TypedObject.search.
"""
# handle me, self
if ostring in (_ME, _SELF, '*' + _ME, '*' + _SELF):
return self
matches = _GA(self, "__class__").objects.player_search(ostring)
matches = _AT_SEARCH_RESULT(self, ostring, matches, global_search=True)
if matches and return_character: