Skip to content

Commit

Permalink
Fix private attributes ignore in documentation (encode#6601)
Browse files Browse the repository at this point in the history
  • Loading branch information
delimitry authored and sigvef committed Dec 3, 2022
1 parent 1bbe7e3 commit ad1ec2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/api-guide/serializers.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ The following class is an example of a generic serializer that can handle coerci
def to_representation(self, obj):
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
if attribute_name('_'):
if attribute_name.startswith('_'):
# Ignore private attributes.
pass
elif hasattr(attribute, '__call__'):
Expand Down
2 changes: 1 addition & 1 deletion docs/community/3.0-announcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ The following class is an example of a generic serializer that can handle coerci
def to_representation(self, obj):
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
if attribute_name('_'):
if attribute_name.startswith('_'):
# Ignore private attributes.
pass
elif hasattr(attribute, '__call__'):
Expand Down

0 comments on commit ad1ec2b

Please sign in to comment.