mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
removed useless empty use
This commit is contained in:
parent
7f4fee21c6
commit
2b79036af1
|
@ -344,12 +344,6 @@ except ImportError:
|
||||||
return datetime.datetime(**kw)
|
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
|
# Markdown is optional
|
||||||
try:
|
try:
|
||||||
import markdown
|
import markdown
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.db import models
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
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:
|
# 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)
|
return SortedDict(fields)
|
||||||
|
|
||||||
def _get_options_instance(bases, attrs):
|
def _get_options_instance(bases, attrs):
|
||||||
options_class = Meta = empty
|
options_class = Meta = None
|
||||||
if '_options_class' in attrs:
|
if '_options_class' in attrs:
|
||||||
options_class = attrs['_options_class']
|
options_class = attrs['_options_class']
|
||||||
else:
|
else:
|
||||||
|
@ -77,7 +77,7 @@ def _get_options_instance(bases, attrs):
|
||||||
if hasattr(base, '_options_class'):
|
if hasattr(base, '_options_class'):
|
||||||
options_class = getattr(base, '_options_class')
|
options_class = getattr(base, '_options_class')
|
||||||
break
|
break
|
||||||
if options_class is empty:
|
if options_class is None:
|
||||||
raise ImproperlyConfigured, 'A Serializer requires an "_options_class" attribute'
|
raise ImproperlyConfigured, 'A Serializer requires an "_options_class" attribute'
|
||||||
|
|
||||||
if 'Meta' in attrs:
|
if 'Meta' in attrs:
|
||||||
|
@ -87,7 +87,7 @@ def _get_options_instance(bases, attrs):
|
||||||
if hasattr(base, 'Meta'):
|
if hasattr(base, 'Meta'):
|
||||||
Meta = getattr(base, 'Meta')
|
Meta = getattr(base, 'Meta')
|
||||||
break
|
break
|
||||||
if Meta is empty:
|
if Meta is None:
|
||||||
raise ImproperlyConfigured, 'A Serializer requires an "Meta" attribute'
|
raise ImproperlyConfigured, 'A Serializer requires an "Meta" attribute'
|
||||||
|
|
||||||
return options_class(Meta)
|
return options_class(Meta)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user