[ldapparser] raise specific error if the configuration is wrong (closes #2498164)
--- 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):