def get_panel_classes(cls): if cls._panel_classes is None: # Load panels in a temporary variable for thread safety. panel_classes = [] for panel_path in dt_settings.get_panels(): # This logic could be replaced with import_by_path in Django 1.6. try: panel_module, panel_classname = panel_path.rsplit('.', 1) except ValueError: raise ImproperlyConfigured( "%s isn't a debug panel module" % panel_path) try: mod = import_module(panel_module) except ImportError as e: raise ImproperlyConfigured( 'Error importing debug panel %s: "%s"' % (panel_module, e)) try: panel_class = getattr(mod, panel_classname) except AttributeError: raise ImproperlyConfigured( 'Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname)) panel_classes.append(panel_class) cls._panel_classes = panel_classes return cls._panel_classes
def get_panel_classes(cls): if cls._panel_classes is None: # Load panels in a temporary variable for thread safety. panel_classes = [] for panel_path in dt_settings.get_panels(): # This logic could be replaced with import_by_path in Django 1.6. try: panel_module, panel_classname = panel_path.rsplit('.', 1) except ValueError: raise ImproperlyConfigured( "%s isn't a debug panel module" % panel_path) try: mod = import_module(panel_module) except ImportError as e: raise ImproperlyConfigured( 'Error importing debug panel %s: "%s"' % (panel_module, e)) try: panel_class = getattr(mod, panel_classname) except AttributeError: raise ImproperlyConfigured( 'Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname)) panel_classes.append(panel_class) cls._panel_classes = panel_classes return cls._panel_classes
def get_panel_classes(cls): if cls._panel_classes is None: # Load panels in a temporary variable for thread safety. panel_classes = [ import_string(panel_path) for panel_path in dt_settings.get_panels() ] cls._panel_classes = panel_classes return cls._panel_classes
def get_panel_classes(cls): if cls._panel_classes is None: # Load panels in a temporary variable for thread safety. panel_classes = [ import_string(panel_path) for panel_path in dt_settings.get_panels() ] cls._panel_classes = panel_classes return cls._panel_classes
def check_panels(app_configs, **kwargs): errors = [] panels = dt_settings.get_panels() if not panels: errors.append( Warning( "Setting DEBUG_TOOLBAR_PANELS is empty.", hint="Set DEBUG_TOOLBAR_PANELS to a non-empty list in your " "settings.py.", id="debug_toolbar.W005", )) return errors