diff --git a/pym/cl_datavars.py b/pym/cl_datavars.py index 857767a..29b42d0 100644 --- a/pym/cl_datavars.py +++ b/pym/cl_datavars.py @@ -805,13 +805,13 @@ class glob_attr: config config file name name param name """ - reMatch = re.compile("^%s\s*=\s*\"?(.*)\"?$"%name, re.I) + reMatch = re.compile("^%s\s*=\s*\"?(.*?)\"?$"%name, re.I) try: if os.path.exists(config): for line in open(config,"r").readlines(): match = reMatch.match(line) if match: - return group().strip() + return match.groups()[0].strip() except: pass return False diff --git a/pym/cl_fill.py b/pym/cl_fill.py index b0fb180..0bf69c3 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -197,6 +197,9 @@ class clLocale: def isLangExists(self,lang): return lang in self.lang.keys() + def isValueInFieldExists(self,field,value): + return value in map(lambda x:self.lang[x][field],self.lang.keys()) + def getFields(self,field): return [ l[1][field] for l in self.lang.items() ] @@ -569,7 +572,10 @@ class fillVars(glob_attr): elif os.environ.has_key("LANG"): return os.environ["LANG"] else: - return locale.getFieldByLang("locale","default") + localeVal = self.getValueFromConfig('/etc/env.d/02locale','LANG') + if locale.isValueInFieldExists('locale',localeVal): + return localeVal + return locale.getFieldByLang("locale","default") def get_os_locale_lang(self): """lang (example: ru_RU)""" @@ -709,7 +715,7 @@ class fillVars(glob_attr): xorg_log_file = '/var/log/Xorg.%s.log' % \ display_number.group(1) if os.path.exists(xorg_log_file): - matchStrs = [i for i in open(xorg_log_file) + matchStrs = [i for i in open(xorg_log_file) if "drv" in i and reDriver.search(i)] if matchStrs: resDriver = re.search(r'([^/]+)_drv.so', @@ -724,7 +730,7 @@ class fillVars(glob_attr): if matchSect: resDriver = re.search(r'Driver\s*"([^"]+)"', matchSect.group(0),re.S) - if resDriver: + if resDriver and resDriver.group(1) in list_avialable_drivers: return resDriver.group(1) defaultDriver = { 'vesa':'vesa',