Better handle using typeclass-cmd with mismatched db table. Resolve #2350.
This commit is contained in:
parent
e91671c053
commit
5ac69a7b0d
3 changed files with 71 additions and 9 deletions
|
|
@ -485,6 +485,23 @@ class TypedObject(SharedMemoryModel):
|
|||
# Object manipulation methods
|
||||
#
|
||||
|
||||
@classmethod
|
||||
def search(cls, query, **kwargs):
|
||||
"""
|
||||
Overridden by class children. This implements a common API.
|
||||
|
||||
Args:
|
||||
query (str): A search query.
|
||||
**kwargs: Other search parameters.
|
||||
|
||||
Returns:
|
||||
list: A list of 0, 1 or more matches, only of this typeclass.
|
||||
|
||||
"""
|
||||
if cls.objects.dbref(query):
|
||||
return [cls.objects.get_id(query)]
|
||||
return list(cls.objects.filter(db_key__lower=query))
|
||||
|
||||
def is_typeclass(self, typeclass, exact=False):
|
||||
"""
|
||||
Returns true if this object has this type OR has a typeclass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue