Add default parameter to get_attr method
This commit is contained in:
parent
4faaf2c3ad
commit
de9472a08a
1 changed files with 3 additions and 3 deletions
|
@ -105,17 +105,17 @@ class LdapServer(object):
|
|||
def get_dn(self,obj):
|
||||
return obj[0][0]
|
||||
|
||||
def get_attr(self,obj,attr,all=None):
|
||||
def get_attr(self,obj,attr,all=None,default=None):
|
||||
if all is not None:
|
||||
if attr in obj:
|
||||
return obj[attr]
|
||||
else:
|
||||
return []
|
||||
return default or []
|
||||
else:
|
||||
if attr in obj:
|
||||
return obj[attr][0]
|
||||
else:
|
||||
return None
|
||||
return default
|
||||
|
||||
class LdapServerException(BaseException):
|
||||
def __init__(self,msg):
|
||||
|
|
Loading…
Reference in a new issue