cubicweb/server/sources/ldapfeed.py
branch3.25
changeset 12144 f54286c1cef5
parent 12143 a446124bcf3c
child 12148 79160d54662e
--- a/cubicweb/server/sources/ldapfeed.py	Wed Apr 05 14:02:58 2017 +0200
+++ b/cubicweb/server/sources/ldapfeed.py	Wed Apr 05 14:31:44 2017 +0200
@@ -178,6 +178,16 @@
 
     def init(self, activated, source_entity):
         super(LDAPFeedSource, self).init(activated, source_entity)
+        if self.urls:
+            if len(self.urls) > 1:
+                raise ValidationError(source_entity.eid, {'url': _('can only have one url')})
+            try:
+                protocol, hostport = self.urls[0].split('://')
+            except ValueError:
+                raise ValidationError(source_entity.eid, {'url': _('badly formatted url')})
+            if protocol not in PROTO_PORT:
+                raise ValidationError(source_entity.eid, {'url': _('unsupported protocol')})
+
         typedconfig = self.config
         self.authmode = typedconfig['auth-mode']
         self._authenticate = getattr(self, '_auth_%s' % self.authmode)
@@ -206,18 +216,6 @@
             self.group_base_filters.append(typedconfig['group-filter'])
         self._conn = None
 
-    def _entity_update(self, source_entity):
-        super(LDAPFeedSource, self)._entity_update(source_entity)
-        if self.urls:
-            if len(self.urls) > 1:
-                raise ValidationError(source_entity.eid, {'url': _('can only have one url')})
-            try:
-                protocol, hostport = self.urls[0].split('://')
-            except ValueError:
-                raise ValidationError(source_entity.eid, {'url': _('badly formatted url')})
-            if protocol not in PROTO_PORT:
-                raise ValidationError(source_entity.eid, {'url': _('unsupported protocol')})
-
     def connection_info(self):
         assert len(self.urls) == 1, self.urls
         protocol, hostport = self.urls[0].split('://')