Skip to content

Commit 791d48c

Browse files
authored
Enforce is_valid(raise_exception=False) as a keyword-only argument. (#7952)
* make raise_exception a keyword-only argument * make raise_exception keyword-only in metaclass
1 parent 35a6d65 commit 791d48c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def save(self, **kwargs):
216216

217217
return self.instance
218218

219-
def is_valid(self, raise_exception=False):
219+
def is_valid(self, *, raise_exception=False):
220220
assert hasattr(self, 'initial_data'), (
221221
'Cannot call `.is_valid()` as no `data=` keyword argument was '
222222
'passed when instantiating the serializer instance.'
@@ -735,7 +735,7 @@ def save(self, **kwargs):
735735

736736
return self.instance
737737

738-
def is_valid(self, raise_exception=False):
738+
def is_valid(self, *, raise_exception=False):
739739
# This implementation is the same as the default,
740740
# except that we use lists, rather than dicts, as the empty case.
741741
assert hasattr(self, 'initial_data'), (

0 commit comments

Comments
 (0)