[core] Light restyling of the appmanager
@@ -23,15 +23,19 @@ import sys
import traceback
import pkg_resources
+from django.utils.translation import ugettext as _
+
import desktop
+
from desktop.lib.paths import get_desktop_root
-from django.utils.translation import ugettext as _
# Directories where apps and libraries are to be found
-APP_DIRS = [get_desktop_root('core-apps'),
+APP_DIRS = [
+ get_desktop_root('core-apps'),
get_desktop_root('apps'),
- get_desktop_root('libs')]
+ get_desktop_root('libs')
+]
LOG = logging.getLogger(__name__)
@@ -133,10 +137,12 @@ class DesktopModuleInfo(object):
self.display_name = self.config_key
# Look for static directory in two places:
- new_style, old_style = [ os.path.abspath(p) for p in [
+ new_style, old_style = [
+ os.path.abspath(p) for p in [
os.path.join(module_root, "static", self.name),
os.path.join(self.root_dir, "static")
- ]]
+ ]
+ ]
self.static_dir = None
if os.path.isdir(new_style):
@@ -231,7 +237,6 @@ def load_libs():
m = lib.load()
DESKTOP_LIBS.append(DesktopModuleInfo(m))
-
LOG.debug("Loaded Desktop Libraries: " + ", ".join(a.name for a in DESKTOP_LIBS))
DESKTOP_MODULES += DESKTOP_LIBS
# Desktop itself is "special"; neither an app or a lib, but
@@ -241,10 +246,9 @@ def load_libs():
def load_apps(app_blacklist):
- """Loads the applications from the directories in APP_DIRS.
+ """
+ Loads the applications from the directories in APP_DIRS.
Sets DESKTOP_MODULES and DJANGO_APPS globals in this module.
-
- TODO(todd) make this a singleton perhaps if people are anti-global?
"""
global DESKTOP_MODULES
global DESKTOP_APPS
