Beispiel #1
0
 def __init__(self, *args, **kwargs):
     ExtApplication.__init__(self, *args, **kwargs)
     #
     # Parse themes
     self.default_theme = config.get("customization", "default_theme")
     self.themes = {}  # id -> {name: , css:}
     for o in config.options("themes"):
         if o.endswith(".name"):
             theme_id = o[:-5]
             nk = "%s.name" % theme_id
             ek = "%s.enabled" % theme_id
             if (config.has_option("themes", nk) and
                 config.has_option("themes", ek) and
                 config.getboolean("themes", ek)):
                 self.themes[theme_id] = {
                     "id": theme_id,
                     "name": config.get("themes", nk).strip(),
                     "css": "/static/pkg/extjs/packages/ext-theme-%s/build/resources/ext-theme-%s-all.css" % (theme_id, theme_id),
                     "js": "/static/pkg/extjs/packages/ext-theme-%s/build/ext-theme-%s.js" % (theme_id, theme_id)
                 }
     # Login restrictions
     self.restrict_to_group = self.get_group(
         config.get("authentication", "restrict_to_group"))
     self.single_session_group = self.get_group(
         config.get("authentication", "single_session_group"))
     self.mutual_exclusive_group = self.get_group(
         config.get("authentication", "mutual_exclusive_group"))
     self.idle_timeout = config.getint("authentication", "idle_timeout")
Beispiel #2
0
def solutions_roots():
    """
    Generator returning active solutions roots
    """
    for sn in config.options("solutions"):
        if config.getboolean("solutions", sn):
            vendor, name = sn.split(".", 1)
            yield os.path.join("solutions", vendor, name)
Beispiel #3
0
def read_solutions_configs(config, name):
    cn = os.path.splitext(name)[0]
    # Update config with solution's one
    for sn in config.options("solutions"):
        if config.getboolean("solutions", sn):
            v, s = sn.split(".", 1)
            c = os.path.join("solutions", v, s, "etc", cn)
            config.read([c + ".defaults", c + ".conf"])
Beispiel #4
0
def init_solutions():
    """
    Initialize solutions and load modules
    """
    from noc.main.models import CustomField
    CustomField.install_fields()
    for sn in config.options("solutions"):
        if config.getboolean("solutions", sn):
            load_solution(sn)
Beispiel #5
0
 def setup(cls):
     from noc.settings import config
     for opt in config.options("i18n"):
         if opt.startswith("collections."):
             cn = opt[12:]
             if cn.endswith(".allow_fuzzy"):
                 cn = opt[:-12]
                 if cn == "global":
                     cn = None
                 cls.ALLOW_FUZZY[cn] = config.getboolean("i18n", opt)
             else:
                 if cn == "global":
                     cn = None
                 tr = [
                     x.strip() for x in config.get("i18n", opt).split(",")
                 ]
                 if "en" not in tr:
                     tr += ["en"]
                 cls.TRANSLATIONS[cn] = tr