Prechádzať zdrojové kódy

[imapala] Example doesn't fail with already installed message

Karissa McKelvey 11 rokov pred
rodič
commit
ed8695c

+ 12 - 2
apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py

@@ -33,7 +33,7 @@ from beeswax.design import hql_query
 from beeswax.server import dbms
 from beeswax.server.dbms import get_query_server_config, QueryServerException
 from useradmin.models import install_sample_user
-
+from desktop.lib.exceptions_renderable import PopupException
 
 LOG = logging.getLogger(__name__)
 
@@ -64,7 +64,17 @@ class Command(NoArgsCommand):
     Document.objects.sync()
 
     if exception is not None:
-      raise exception
+      pretty_msg = None
+      
+      if "AlreadyExistsException" in exception.message:
+        pretty_msg = _("SQL table examples already installed.")
+      if "Permission denied" in exception.message:
+        pretty_msg = _("Permission denied. Please check with your system administrator.")
+
+      if pretty_msg is not None:
+        raise PopupException(pretty_msg)
+      else: 
+        raise exception
 
   def _install_tables(self, django_user, app_name):
     data_dir = beeswax.conf.LOCAL_EXAMPLES_DATA_DIR.get()