sobjects/ldapparser.py
branchstable
changeset 8566 76bcfb3c483d
parent 8479 19cc6eb51783
child 8573 ae0a567dff30
child 8575 688d108af306
--- a/sobjects/ldapparser.py	Mon Oct 08 17:50:12 2012 +0200
+++ b/sobjects/ldapparser.py	Mon Oct 01 12:40:35 2012 +0200
@@ -25,7 +25,7 @@
 from logilab.common.decorators import cached
 from logilab.common.shellutils import generate_password
 
-from cubicweb import Binary
+from cubicweb import Binary, ConfigurationError
 from cubicweb.server.utils import crypt_password
 from cubicweb.server.sources import datafeed
 
@@ -92,7 +92,12 @@
             tdict = {}
         for sattr, tattr in self.source.user_attrs.iteritems():
             if tattr not in self.non_attribute_keys:
-                tdict[tattr] = sdict[sattr]
+                try:
+                    tdict[tattr] = sdict[sattr]
+                except KeyError:
+                    raise ConfigurationError('source attribute %s is not present '
+                                             'in the source, please check the '
+                                             'user-attrs-map field' % sattr)
         return tdict
 
     def before_entity_copy(self, entity, sourceparams):