Make all manager methods return querysets. This removes all the last remnants of the old return_typeclass/return_typeclass_list decorators that were a remnant of the old pre-proxy Typeclass system. Resolves #1206.

This commit is contained in:
Griatch 2017-04-20 19:43:39 +02:00
parent dd7d18f041
commit cf77d90c71
7 changed files with 25 additions and 98 deletions

View file

@ -7,7 +7,6 @@ from django.db.models import Q
from django.conf import settings
from django.db.models.fields import exceptions
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
from evennia.typeclasses.managers import returns_typeclass, returns_typeclass_list
from evennia.utils.utils import to_unicode, is_iter, make_iter, string_partial_matching
from builtins import int
@ -56,7 +55,6 @@ class ObjectDBManager(TypedObjectManager):
# player related
@returns_typeclass
def get_object_with_player(self, ostring, exact=True, candidates=None):
"""
Search for an object based on its player's name or dbref.
@ -93,7 +91,6 @@ class ObjectDBManager(TypedObjectManager):
else:
return string_partial_matching(ply_cands, ostring, ret_index=False)
@returns_typeclass_list
def get_objs_with_key_and_typeclass(self, oname, otypeclass_path, candidates=None):
"""
Returns objects based on simultaneous key and typeclass match.
@ -112,7 +109,6 @@ class ObjectDBManager(TypedObjectManager):
# attr/property related
@returns_typeclass_list
def get_objs_with_attr(self, attribute_name, candidates=None):
"""
Get objects based on having a certain Attribute defined.
@ -130,7 +126,6 @@ class ObjectDBManager(TypedObjectManager):
if obj]) or Q()
return list(self.filter(cand_restriction & Q(db_attributes__db_key=attribute_name)))
@returns_typeclass_list
def get_objs_with_attr_value(self, attribute_name, attribute_value, candidates=None, typeclasses=None):
"""
Get all objects having the given attrname set to the given value.
@ -169,7 +164,6 @@ class ObjectDBManager(TypedObjectManager):
db_value=attribute_value)]
return chain(*results)
@returns_typeclass_list
def get_objs_with_db_property(self, property_name, candidates=None):
"""
Get all objects having a given db field property.
@ -191,7 +185,6 @@ class ObjectDBManager(TypedObjectManager):
except exceptions.FieldError:
return []
@returns_typeclass_list
def get_objs_with_db_property_value(self, property_name, property_value, candidates=None, typeclasses=None):
"""
Get objects with a specific field name and value.
@ -222,7 +215,6 @@ class ObjectDBManager(TypedObjectManager):
(property_name, type(property_value)))
return []
@returns_typeclass_list
def get_contents(self, location, excludeobj=None):
"""
Get all objects that has a location set to this one.
@ -238,7 +230,6 @@ class ObjectDBManager(TypedObjectManager):
exclude_restriction = Q(pk__in=[_GA(obj, "id") for obj in make_iter(excludeobj)]) if excludeobj else Q()
return self.filter(db_location=location).exclude(exclude_restriction)
@returns_typeclass_list
def get_objs_with_key_or_alias(self, ostring, exact=True,
candidates=None, typeclasses=None):
"""
@ -303,7 +294,6 @@ class ObjectDBManager(TypedObjectManager):
# main search methods and helper functions
@returns_typeclass_list
def search_object(self, searchdata,
attribute_name=None,
typeclass=None,