magic-removal: Collapsed else statements in SingleRelatedObjectDescriptor and ManyRelatedObjectsDescriptor

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-03 19:11:04 +00:00
parent fe94847e2c
commit ce0c6887d6
1 changed files with 43 additions and 44 deletions

View File

@ -74,7 +74,6 @@ class SingleRelatedObjectDescriptor(object):
def __get__(self, instance, instance_type=None):
if instance is None:
raise AttributeError, "%s must be accessed via instance" % self._field.name
else:
cache_name = self._field.get_cache_name()
try:
return getattr(instance, cache_name)
@ -94,7 +93,8 @@ class SingleRelatedObjectDescriptor(object):
class ManyRelatedObjectsDescriptor(object):
# This class provides the functionality that makes the related-object
# managers available as attributes on a model class, for fields that have
# multiple "remote" values.
# multiple "remote" values and have a ManyToManyField pointed at them by
# some other model (rather than having a ManyToManyField themselves).
# In the example "poll.choice_set", the choice_set attribute is a
# ManyRelatedObjectsDescriptor instance.
def __init__(self, related, rel_type):
@ -104,7 +104,6 @@ class ManyRelatedObjectsDescriptor(object):
def __get__(self, instance, instance_type=None):
if instance is None:
raise AttributeError, "Manager must be accessed via instance"
else:
# Dynamically create a class that subclasses the related
# model's default manager.
superclass = self.related.model._default_manager.__class__