mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 16:26:30 +01:00
Fixed a lacking implementation in the Msg API. You need to re-sync the database since Msg now relies on three fields that where commented out before.
This commit is contained in:
parent
72bb8ac667
commit
d90c2909a2
6 changed files with 33 additions and 27 deletions
|
|
@ -4,7 +4,7 @@ Custom manager for Objects.
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from src.typeclasses.managers import TypedObjectManager
|
||||
from src.typeclasses.managers import returns_typeclass_list
|
||||
from src.typeclasses.managers import returns_typeclass, returns_typeclass_list
|
||||
from src.utils import create
|
||||
|
||||
# Try to use a custom way to parse id-tagged multimatches.
|
||||
|
|
@ -62,17 +62,23 @@ class ObjectManager(TypedObjectManager):
|
|||
# ObjectManager Get methods
|
||||
#
|
||||
|
||||
@returns_typeclass_list
|
||||
@returns_typeclass
|
||||
def get_object_with_user(self, user):
|
||||
"""
|
||||
Matches objects with obj.player.user matching the argument.
|
||||
Both an user object and a user id may be supplied.
|
||||
A player<->user is a one-to-relationship, so this always
|
||||
returns just one result or None.
|
||||
|
||||
user - mayb be a user object or user id.
|
||||
"""
|
||||
try:
|
||||
uid = int(user)
|
||||
except TypeError:
|
||||
uid = user.id
|
||||
return self.filter(db_player__user__id=uid)
|
||||
uid = user.id
|
||||
try:
|
||||
return self.get(db_player__user__id=uid)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
# This returns typeclass since get_object_with_user and get_dbref does.
|
||||
def player_name_search(self, search_string):
|
||||
|
|
@ -273,7 +279,7 @@ class ObjectManager(TypedObjectManager):
|
|||
player_string = ostring.lstrip("*")
|
||||
player_match = self.player_name_search(player_string)
|
||||
if player_match is not None:
|
||||
return [player_match]
|
||||
return [player_match]
|
||||
|
||||
if global_search or not location:
|
||||
# search all objects
|
||||
|
|
|
|||
|
|
@ -450,6 +450,7 @@ class ObjectDB(TypedObject):
|
|||
results = ObjectDB.objects.object_search(self, ostring,
|
||||
global_search,
|
||||
attribute_name)
|
||||
|
||||
if ignore_errors:
|
||||
return results
|
||||
return HANDLE_SEARCH_ERRORS(self, ostring, results, global_search)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue