Browse files

Remove asserts for optional imports

Horizon's has some code that explicitly allows it to
be imported by before Django is set up, by making import
failures just throw a warning instead of an exception. But that code
is defeated by a bunch of asserts that were added later, that just
make the error even more confusing.

I'm removing the asserts and replacing them with __all__.

Closes-bug: #1210253
Change-Id: I0fde7810a033fd7216da9a5460f5e4e323b4d6e9
  • Loading branch information...
1 parent e543879 commit b6eb9a2480a82cf93f7a62e9c7373feddc8296fe @deshipu deshipu committed Nov 15, 2013
Showing with 14 additions and 3 deletions.
  1. +14 −3 horizon/
@@ -52,6 +52,17 @@ def simple_warn(message, category, filename, lineno, file=None, line=None):
urls = Horizon._lazy_urls
# silence flake8 about unused imports here:
-assert Dashboard
-assert Panel
-assert PanelGroup
+__all__ = [
+ "Dashboard",
+ "Horizon",
+ "Panel",
+ "PanelGroup",
+ "register",
+ "unregister",
+ "get_absolute_url",
+ "get_user_home",
+ "get_dashboard",
+ "get_default_dashboard",
+ "get_dashboards",
+ "urls",

0 comments on commit b6eb9a2

Please sign in to comment.