diff --git a/rest_framework/compat.py b/rest_framework/compat.py index b09487f38..cadc2d2b6 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -344,12 +344,6 @@ except ImportError: return datetime.datetime(**kw) -# empty does not exist in 1.3x -if django.VERSION >= (1, 4): - from django.utils.functional import empty -else: - empty = object() - # Markdown is optional try: import markdown diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 8e245405a..dbc13a4ca 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -6,7 +6,7 @@ from django.db import models from django.forms import widgets from django.utils.datastructures import SortedDict from django.core.exceptions import ImproperlyConfigured -from rest_framework.compat import get_concrete_model, empty +from rest_framework.compat import get_concrete_model # Note: We do the following so that users of the framework can use this style: # @@ -69,7 +69,7 @@ def _get_declared_fields(bases, attrs): return SortedDict(fields) def _get_options_instance(bases, attrs): - options_class = Meta = empty + options_class = Meta = None if '_options_class' in attrs: options_class = attrs['_options_class'] else: @@ -77,7 +77,7 @@ def _get_options_instance(bases, attrs): if hasattr(base, '_options_class'): options_class = getattr(base, '_options_class') break - if options_class is empty: + if options_class is None: raise ImproperlyConfigured, 'A Serializer requires an "_options_class" attribute' if 'Meta' in attrs: @@ -87,7 +87,7 @@ def _get_options_instance(bases, attrs): if hasattr(base, 'Meta'): Meta = getattr(base, 'Meta') break - if Meta is empty: + if Meta is None: raise ImproperlyConfigured, 'A Serializer requires an "Meta" attribute' return options_class(Meta)