Commit b2b76344 authored by Gregor MacGregor's avatar Gregor MacGregor Committed by Tim Graham
Browse files

Fixed #20841 -- Added messages to NotImplementedErrors

Thanks joseph at vertstudios.com for the suggestion.
parent d59f1993
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -33,26 +33,26 @@ class ListFilter(object):
        """
        Returns True if some choices would be output for this filter.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of ListFilter must provide a has_output() method')

    def choices(self, cl):
        """
        Returns choices ready to be output in the template.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of ListFilter must provide a choices() method')

    def queryset(self, request, queryset):
        """
        Returns the filtered queryset.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of ListFilter must provide a queryset() method')

    def expected_parameters(self):
        """
        Returns the list of parameter names that are expected from the
        request's query string and that will be used by this filter.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of ListFilter must provide an expected_parameters() method')


class SimpleListFilter(ListFilter):
@@ -89,7 +89,9 @@ class SimpleListFilter(ListFilter):
        """
        Must be overridden to return a list of tuples (value, verbose value)
        """
        raise NotImplementedError
        raise NotImplementedError(
            'The SimpleListFilter.lookups() method must be overridden to '
            'return a list of tuples (value, verbose value)')

    def expected_parameters(self):
        return [self.parameter_name]
+3 −3
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ class BasePasswordHasher(object):
        """
        Checks if the given password is correct
        """
        raise NotImplementedError()
        raise NotImplementedError('subclasses of BasePasswordHasher must provide a verify() method')

    def encode(self, password, salt):
        """
@@ -201,7 +201,7 @@ class BasePasswordHasher(object):
        The result is normally formatted as "algorithm$salt$hash" and
        must be fewer than 128 characters.
        """
        raise NotImplementedError()
        raise NotImplementedError('subclasses of BasePasswordHasher must provide an encode() method')

    def safe_summary(self, encoded):
        """
@@ -210,7 +210,7 @@ class BasePasswordHasher(object):
        The result is a dictionary and will be used where the password field
        must be displayed to construct a safe representation of the password.
        """
        raise NotImplementedError()
        raise NotImplementedError('subclasses of BasePasswordHasher must provide a safe_summary() method')


class PBKDF2PasswordHasher(BasePasswordHasher):
+6 −6
Original line number Diff line number Diff line
@@ -245,10 +245,10 @@ class AbstractBaseUser(models.Model):
        return is_password_usable(self.password)

    def get_full_name(self):
        raise NotImplementedError()
        raise NotImplementedError('subclasses of AbstractBaseUser must provide a get_full_name() method')

    def get_short_name(self):
        raise NotImplementedError()
        raise NotImplementedError('subclasses of AbstractBaseUser must provide a get_short_name() method.')


# A few helper functions for common logic between User and AnonymousUser.
@@ -441,16 +441,16 @@ class AnonymousUser(object):
        return 1  # instances always return the same hash value

    def save(self):
        raise NotImplementedError
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def delete(self):
        raise NotImplementedError
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def set_password(self, raw_password):
        raise NotImplementedError
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def check_password(self, raw_password):
        raise NotImplementedError
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def _get_groups(self):
        return self._groups
+1 −2
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ class BaseCommentNode(six.with_metaclass(RenameBaseCommentNodeMethods, template.

    def get_context_value_from_queryset(self, context, qs):
        """Subclasses should override this."""
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseCommentNode must provide a get_context_value_from_queryset() method')

class CommentListNode(BaseCommentNode):
    """Insert a list of comments into the context."""
@@ -338,4 +338,3 @@ def get_comment_permalink(comment, anchor_pattern=None):
    if anchor_pattern:
        return comment.get_absolute_url(anchor_pattern)
    return comment.get_absolute_url()
+5 −5
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class BaseSpatialOperations(object):
        Returns the database column type for the geometry field on
        the spatial backend.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseSpatialOperations must provide a geo_db_type() method')

    def get_distance(self, f, value, lookup_type):
        """
@@ -117,7 +117,7 @@ class BaseSpatialOperations(object):
        stored procedure call to the transformation function of the spatial
        backend.
        """
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseSpatialOperations must provide a geo_db_placeholder() method')

    def get_expression_column(self, evaluator):
        """
@@ -134,14 +134,14 @@ class BaseSpatialOperations(object):
        raise NotImplementedError('Aggregate support not implemented for this spatial backend.')

    def spatial_lookup_sql(self, lvalue, lookup_type, value, field):
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_lookup_sql() method')

    # Routines for getting the OGC-compliant models.
    def geometry_columns(self):
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide geometry_columns() method')

    def spatial_ref_sys(self):
        raise NotImplementedError
        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_ref_sys() method')

@python_2_unicode_compatible
class SpatialRefSysMixin(object):
Loading