Skip to content

Commit 46eef6c

Browse files
committed
fix: typo in get para: deafult -> default
This commit maintains compatibility with existing code using the mistyped `deafult` parameter. close #417
1 parent cf3aef9 commit 46eef6c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

leancloud/object_.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,18 @@ def validate(self, attrs):
342342
raise TypeError('acl must be a ACL')
343343
return True
344344

345-
def get(self, attr, deafult=None):
345+
def get(self, attr, default=None, deafult=None):
346346
"""
347347
获取对象字段的值
348348
349349
:param attr: 字段名
350350
:type attr: string_types
351351
:return: 字段值
352352
"""
353-
return self._attributes.get(attr, deafult)
353+
# for backward compatibility
354+
if (deafult is not None) and (default is None):
355+
default = deafult
356+
return self._attributes.get(attr, default)
354357

355358
def relation(self, attr):
356359
"""

0 commit comments

Comments
 (0)