Add default parameter to get_attr method

This commit is contained in:
Benjamin Renard 2015-04-01 17:08:43 +02:00
parent 4faaf2c3ad
commit de9472a08a

View file

@ -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):