mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-18 20:22:22 +03:00
set booleant false as type of empty class
This commit is contained in:
parent
f56b85b7dd
commit
5d53627da3
|
@ -46,7 +46,19 @@ from rest_framework.validators import ProhibitSurrogateCharactersValidator
|
|||
logger = logging.getLogger("rest_framework.fields")
|
||||
|
||||
|
||||
class empty:
|
||||
class EmptyType(type):
|
||||
"""
|
||||
Metaclass for overriding the boolean representation of a class.
|
||||
|
||||
When a class uses this metaclass, its type (the class itself, not its instances)
|
||||
will evaluate to `False` in boolean contexts.
|
||||
"""
|
||||
|
||||
def __bool__(self):
|
||||
return False
|
||||
|
||||
|
||||
class empty(metaclass=EmptyType):
|
||||
"""
|
||||
This class is used to represent no data being provided for a given input
|
||||
or output value.
|
||||
|
|
Loading…
Reference in New Issue
Block a user