Просмотр исходного кода

HUE-8584 [useradmin] Bubbling up errors for Add Sync Ldap Group

Ying Chen 7 лет назад
Родитель
Сommit
9d8c013

+ 3 - 0
apps/useradmin/src/useradmin/templates/edit_group.mako

@@ -114,6 +114,9 @@ ${layout.menubar(section='groups')}
           huePubSub.publish('open.link', data.url);
           $.jHueNotify.info("${ _('Group information updated correctly') }");
         }
+      },
+      error: function (data) {
+        $.jHueNotify.error(data.responseJSON['message']);
       }
     });
     % endif

+ 4 - 3
apps/useradmin/src/useradmin/views.py

@@ -635,10 +635,11 @@ def add_ldap_groups(request):
                                     import_members_recursive=import_members_recursive, sync_users=True,
                                     import_by_dn=import_by_dn, failed_users=failed_ldap_users)
       except (ldap.LDAPError, LdapBindException), e:
-        LOG.error(_("LDAP Exception: %s") % e)
-        raise PopupException(_('There was an error when communicating with LDAP'), detail=str(e))
+        LOG.error("LDAP Exception: %s" % smart_str(e))
+        raise PopupException(smart_str(_('There was an error when communicating with LDAP: %s')) % str(e))
       except ValidationError, e:
-        raise PopupException(_('There was a problem with some of the LDAP information'), detail=str(e))
+        LOG.error("LDAP Exception: %s" % smart_str(e))
+        raise PopupException(smart_str(_('There was a problem with some of the LDAP information: %s')) % str(e))
 
       unique_users = set()
       if is_ensuring_home_directories and groups:

+ 1 - 1
desktop/core/src/desktop/auth/forms.py

@@ -159,7 +159,7 @@ class LdapAuthenticationForm(AuthenticationForm):
             get_ldap_connection(conf.LDAP)
         except Exception as e:
           LOG.error("LDAP Exception: %s" % smart_str(e))
-          raise ValidationError(_("LDAP server %s Error: %s").encode('utf-8') % (server_key, str(e)))
+          raise ValidationError(smart_str(_("LDAP server %s Error: %s")) % (server_key, str(e)))
 
         raise ValidationError(
           self.error_messages['invalid_login'])