def init_app(self, app): self.app = app self.app.logger.debug("IPB Sync is enabled.") # Registering events models_committed.connect_via(app)(self.handle_commit)
def init_app(self, app): self.app = app app.config.setdefault('SYNC_LDAP_HOST', '127.0.0.1') app.config.setdefault('SYNC_LDAP_PORT', 389) app.config.setdefault('SYNC_LDAP_ADMIN_USER', 'cn=admin,dc=example,dc=com') app.config.setdefault('SYNC_LDAP_ADMIN_PASS', 'password') app.config.setdefault('SYNC_LDAP_BASEDN', 'dc=example,dc=com') app.config.setdefault('SYNC_LDAP_MEMBERDN', 'ou=People,dc=example,dc=com') app.logger.debug('LDAP Synchronizer has been initialized. Attempting connection.') try: self.setup_connection() except Exception as e: app.logger.error('LDAP Synchronizer could not connect to the LDAP server.') app.logger.exception(e) models_committed.connect_via(app)(self.handle_commit) User.password_updated.connect_via(app)(self.update_user_password)