Add default parameter to get_attr method
Benjamin Renard

Benjamin Renard commited on 2015-04-01 15:08:43
Showing 1 changed files, with 3 additions and 3 deletions.

... ...
@@ -105,17 +105,17 @@ class LdapServer(object):
105 105
 	def get_dn(self,obj):
106 106
 		return obj[0][0]
107 107
 
108
-	def get_attr(self,obj,attr,all=None):
108
+	def get_attr(self,obj,attr,all=None,default=None):
109 109
 		if all is not None:
110 110
 			if attr in obj:
111 111
 				return obj[attr]
112 112
 			else:
113
-				return []
113
+				return default or []
114 114
 		else:
115 115
 			if attr in obj:
116 116
 				return obj[attr][0]
117 117
 			else:
118
-				return None
118
+				return default
119 119
 
120 120
 class LdapServerException(BaseException):
121 121
 	def __init__(self,msg):
122 122