Пример #1
0
    def __init__(self,base_path=None):
        """
        Initialize
        """
        if base_path == None:
          ## Try to find based on this existing under work/i18ntools
            found = False
            directories = Utility.get_base_path().split("/")
            while found == False and len(directories) > 0:
                check_path = "/".join(directories)
                if os.path.isdir(check_path + "/ngfw_src"):
                    found = True
                    self.base_path = check_path
                del directories[len(directories)-1]

            if found == False:
                self.base_path = Utility.get_base_path(self.path)
        else:
            self.base_path = base_path

        self.load()

        self.search_paths = []
        for directory in self.directories:
            self.search_paths.append(self.base_path + "/" + directory)

        self.__dict__["regex_comment_prefix"] = re.compile(r'' + self.base_path)
Пример #2
0
    def __init__(self,base_path=None):
        """
        Initialize
        """
        if base_path == None:
          ## Try to find based on this existing under work/i18ntools
            found = False
            directories = Utility.get_base_path().split("/")
            while found == False and len(directories) > 0:
                check_path = "/".join(directories)
                if os.path.isdir(check_path + "/ngfw_src"):
                    found = True
                    self.base_path = check_path
                del directories[len(directories)-1]

            if found == False:
                self.base_path = Utility.get_base_path(self.path)
        else:
            self.base_path = base_path

        self.load()

        self.search_paths = []
        for directory in self.directories:
            self.search_paths.append(self.base_path + "/" + directory)

        self.__dict__["regex_comment_prefix"] = re.compile(r'' + self.base_path)
Пример #3
0
 def build_file_name(self):
     """
     Create filename from language
     """
     self.file_name = Utility.get_base_path(
     ) + self.path + "/%s/untangle-%s.%s" % (self.language, self.language,
                                             self.extension)
Пример #4
0
 def load(self):
     """
     Load configuration
     """
     full_file_name = Utility.get_base_path() + "/" + self.file_name
     ngfw_file = open(full_file_name)
     try:
         settings = json.load(ngfw_file)
     except:
         print("\n".join(str(v) for v in sys.exc_info()))
     for key in settings:
         self.__dict__[key] = settings[key]
     ngfw_file.close()
Пример #5
0
 def load(self):
     """
     Load configuration
     """
     full_file_name = Utility.get_base_path() + "/" + self.file_name
     ngfw_file = open(full_file_name)
     try:
         settings = json.load(ngfw_file)
     except:
         print("\n".join(str(v) for v in sys.exc_info()))
     for key in settings:
         self.__dict__[key] = settings[key]
     ngfw_file.close()
Пример #6
0
    def load(self):
        """
        Load configuration
        """
        full_file_name = Utility.get_base_path() + "/" + self.file_name
        ngfw_file = open(full_file_name)

        try:
            settings = json.load(ngfw_file)
        except:
            print "\n".join(str(v) for v in sys.exc_info())
        for key in settings:
            self.__dict__[key] = settings[key]
            if key == "json_parse_directories":
                self.__dict__["regex_json_parse"] = re.compile(r"/(" + "|".join(settings[key]) + ")/([^/]+).js$")
        ngfw_file.close()
Пример #7
0
    def load(self):
        """
        Load configuration
        """
        full_file_name = Utility.get_base_path() + "/" + self.file_name
        ngfw_file = open(full_file_name)

        try:
            settings = json.load(ngfw_file)
        except:
            print("\n".join(str(v) for v in sys.exc_info()))
        for key in settings:
            self.__dict__[key] = settings[key]
            if key == "json_parse_directories":
                self.__dict__["regex_json_parse"] = re.compile(r"/(" + "|".join(settings[key]) + ")/([^/]+).js$")
        ngfw_file.close()
Пример #8
0
 def build_file_name(self):
     """
     Create filename from language
     """
     self.file_name = Utility.get_base_path() + self.path + "/%s/untangle-%s.%s" % (self.language, self.language, self.extension)