From 6171f9991eb458001488b215a09d34231d5890d4 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 2 Aug 2010 20:14:40 +0000 Subject: [PATCH] Catch the case where attributes that are not declared as an array value have more than one value. This indicates a bug in the data, code, or ldap schema --- UDLdap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UDLdap.py b/UDLdap.py index 3dc2b74..9f8a0fd 100644 --- a/UDLdap.py +++ b/UDLdap.py @@ -31,7 +31,10 @@ class Account: if key in self.array_values: return self.attributes[key] elif key in self.int_values: - return int(self.attributes[key][0]) + if len(self.attributes[key]) == 1: + return int(self.attributes[key][0]) + else: + raise ValueError, 'non-array value has not exactly one value' else: return self.attributes[key][0] elif key in self.defaults: -- 2.20.1