From 5044f529a6de9c7e236b9a5ee8fc1f9c0c07e524 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Mon, 17 Oct 2011 13:24:14 +0400 Subject: [PATCH] Sync english messages with i18n. --- pym/cl_api.py | 12 +- pym/cl_datavars.py | 19 +- pym/cl_fill.py | 7 +- pym/cl_ldap.py | 2 +- pym/cl_opt.py | 17 +- pym/cl_string.py | 3 +- pym/cl_template.py | 311 ++++++++++++---------- pym/cl_utils.py | 9 +- pym/client/progressbar.py | 3 +- pym/encrypt.py | 18 +- pym/format/patch.py | 14 +- pym/format/xml_gconf.py | 8 +- pym/format/xml_gconf_tree.py | 2 +- pym/format/xml_xfce.py | 2 +- pym/format/xml_xfcepanel.py | 2 +- pym/server/ldap.py | 14 +- pym/server/share.py | 4 +- pym/server/users.py | 30 ++- pym/update_config/cl_update_config.py | 20 +- pym/update_config/cl_update_config_cmd.py | 2 +- pym/utils/ip.py | 8 +- 21 files changed, 270 insertions(+), 237 deletions(-) diff --git a/pym/cl_api.py b/pym/cl_api.py index 9354b7b..59dbde5 100644 --- a/pym/cl_api.py +++ b/pym/cl_api.py @@ -61,7 +61,7 @@ class _services(color_print, libVars): 'serviceAPI') except (ImportError, AttributeError), e: self.printERROR(str(e).strip()) - self.printERROR(_("Can not import module %s")% apiFile) + self.printERROR(_("Failed to import module %s")% apiFile) cl_overriding.exit(1) return className @@ -80,7 +80,7 @@ class _services(color_print, libVars): apiObject = className() except Exception, e: self.printERROR(str(e).strip()) - self.printERROR(_("Can not create API object")) + self.printERROR(_("Failed create an API object")) self.printERROR(_("Module %s")% apiFile) cl_overriding.exit(1) self.apiObjs[pkgName] = apiObject @@ -101,7 +101,7 @@ class _services(color_print, libVars): try: apiObjects.append(className()) except: - self.printERROR(_("Can not create API object")) + self.printERROR(_("Failed create an API object")) self.printERROR(_("Module %s")% apiFile) cl_overriding.exit(1) return apiObjects @@ -113,8 +113,8 @@ class _services(color_print, libVars): return "" if not hasattr(pkgObj, methodName) or\ not callable(getattr(pkgObj, methodName)): - self.printERROR(_("Can not found method %(method)s in \ -API object service %(service)s") %{'method':methodName, + self.printERROR(_("Method %(method)s not found in object API of" + " service %(service)s") %{'method':methodName, 'service':pkgObj.getServiceName()}) cl_overriding.exit(1) if argv: @@ -201,7 +201,7 @@ class _pkgAPI(object): try: value = object.__getattribute__(self, attr)() except: - raise APIError(_("Can not found method %s")%attr) + raise APIError(_("Method %s not found")%attr) return value class _allPkg(object): diff --git a/pym/cl_datavars.py b/pym/cl_datavars.py index 09e00d9..a57da52 100644 --- a/pym/cl_datavars.py +++ b/pym/cl_datavars.py @@ -144,7 +144,7 @@ class DataVars(object): try: globals()[modVar] = __import__(modVar) except (ImportError, AttributeError), e: - err1 = _("Error in import module %s")%modVar + err1 = _("Error in importing module %s")%modVar err2 = _("error") + ": " +str(e) raise self.DataVarsError("%s\n%s"%(err1,err2)) @@ -155,7 +155,7 @@ class DataVars(object): if "No module named" in str(e): flagFindFillModule = False else: - err1 = _("Error in import module %s")%modFill + err1 = _("Error in importing module %s")%modFill err2 = _("error") + ": " +str(e) raise self.DataVarsError("%s\n%s"%(err1,err2)) @@ -189,7 +189,7 @@ class DataVars(object): if dataVar is False: dataVar = dataVarWork if dataVar == False: - err1 = _("Not found variable %s")%nameVar + err1 = _("Variable %s not found")%nameVar err2 = "" if e: err2 = _("error") + ": " +str(e) @@ -215,7 +215,7 @@ class DataVars(object): """ if not set(dictVar.keys()) <= set(dir(var)): raise self.DataVarsError(\ - _("error initalize variable %s, incorrect data")%nameVar) + _("error in initalizing variable %s, incorrect data")%nameVar) for nameAttr in dictVar.keys(): setattr(var, nameAttr, dictVar[nameAttr]) return True @@ -340,8 +340,8 @@ class DataVars(object): name_calculate_ini = ini_dict[location] else: cl_overriding.printERROR(\ - _("Unable to find the alias '%s' of the file path for \ -storage of variables templates")%location) + _("Unable to find alias '%s' of the path to the file " + "storing template variables templates")%location) cl_overriding.exit(1) return pathJoin(self.Get('cl_chroot_path'), name_calculate_ini) @@ -354,7 +354,7 @@ storage of variables templates")%location) try: self.Get(vname) except self.DataVarsError, e: - cl_overriding.printERROR(_("Not found template variable %s")\ + cl_overriding.printERROR(_("Template variable %s not found")\ %vname) cl_overriding.printERROR(e) cl_overriding.exit(1) @@ -581,7 +581,8 @@ storage of variables templates")%location) try: value = self.Get(vname) except: - cl_overriding.printERROR(_("error var %s not found")%str(vname)) + cl_overriding.printERROR(_("error, variable %s not found")% + str(vname)) cl_overriding.exit(1) if value: return True @@ -612,7 +613,7 @@ storage of variables templates")%location) try: reFilter = re.compile("%s"%varsFilter) except: - cl_overriding.printERROR(_("wrong vars filter '%s'")\ + cl_overriding.printERROR(_("wrong variable filter '%s'")\ %str(varsFilter)) cl_overriding.exit(1) ret = {} diff --git a/pym/cl_fill.py b/pym/cl_fill.py index 31bbc61..8709eeb 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -81,14 +81,14 @@ class fillVars(varsShare): """Get net domain name""" textLines = self._runos("hostname -d 2>&1") if textLines is False: - cl_overriding.printERROR(_("Error execute 'hostname -d'")) + cl_overriding.printERROR(_("Error executing 'hostname -d'")) return cl_overriding.exit(1) domain = "" if textLines: domain = textLines[0] if not domain: cl_overriding.printERROR(_("Error:") + " " +\ - _("Not found domain name")) + _("Domain name not found")) cl_overriding.printERROR(\ _("Command 'hostname -d' returns an empty value")) return cl_overriding.exit(1) @@ -238,7 +238,8 @@ class fillVars(varsShare): def get_hr_cdrom_set(self): """Cdrom variable""" if os.path.exists('/sys/block/sr0'): - textLines = self._runos("udevadm info --query=all --name=/dev/dvdrw") + textLines = self._runos( + "udevadm info --query=all --name=/dev/dvdrw") if not textLines is False: for line in textLines: if "ID_CDROM=1" in line: diff --git a/pym/cl_ldap.py b/pym/cl_ldap.py index 732b4f8..ac9f87b 100644 --- a/pym/cl_ldap.py +++ b/pym/cl_ldap.py @@ -99,7 +99,7 @@ class ldapUser(_error): dictData[name].append(line.rpartition(spl)[2].\ strip()) except: - #self.setError(_("Can not open %s")%fileName) + #self.setError(_("Failed to open %s")%fileName) return False if set(dictData.keys()) == set(namesData): # Кеширование данных diff --git a/pym/cl_opt.py b/pym/cl_opt.py index 8078d16..1f1f840 100644 --- a/pym/cl_opt.py +++ b/pym/cl_opt.py @@ -278,23 +278,23 @@ class opt(optparse.OptionParser): [{'longOption':"set", 'optVal':"VAR=VALUE", 'action':'append', - 'help':_("set value for variable") + 'help':_("set the variable value") }] variable_view = \ [{'shortOption':"v", 'longOption':"show-variables", 'action':'count', - 'help':_("print variables, if the two options is verbose " - "(added print hidden variables)") + 'help':_("print variables, in verbose mode if the two options " + "applied (includes printing hidden variables)") }, {'longOption':"filter", 'optVal':"FILTER", - 'help':_("filtered variables by regular expression, \ -is used in conjunction with the options '-v --show-variables'") + 'help':_("filter variables (as regexp, use *), to be used in" + " conjunction with options '-v --show-variables'") }, {'longOption':"xml", - 'help':_("output variables in the format of XML, \ -is used in conjunction with the option '-v --show-variables'") + 'help':_("output variables in XML format, to be used in" + " conjunction with options '-v --show-variables'") }] variable_control = variable_set + variable_view @@ -373,7 +373,8 @@ is used in conjunction with the option '-v --show-variables'") should either exit or raise an exception. """ self.print_usage(sys.stderr) - self.exit(2, "%s: %s: %s\n%s\n" % (self.get_prog_name(), _("error"), msg, + self.exit(2, "%s: %s: %s\n%s\n" % (self.get_prog_name(), + _("error"), msg, _("Try `%s' for more information")% ("%s --help"%self.get_prog_name()))) diff --git a/pym/cl_string.py b/pym/cl_string.py index 3708688..f66c711 100644 --- a/pym/cl_string.py +++ b/pym/cl_string.py @@ -344,7 +344,8 @@ class tableReport: convLines.append(self._insertStrChar(lines[i], lenCols, char)) cl_overriding.printSUCCESS("\n".join(convLines)) if printRows: - cl_overriding.printSUCCESS("(%s %s)"%(len(self.dataList), _("rows"))) + cl_overriding.printSUCCESS("(%s %s)"% + (len(self.dataList), _("rows"))) def _insertStrChar(self, line, lenCols, char): """Вставляет несколько символов char в указанные позиции diff --git a/pym/cl_template.py b/pym/cl_template.py index e4b4e72..a11075a 100644 --- a/pym/cl_template.py +++ b/pym/cl_template.py @@ -332,7 +332,7 @@ class _terms(_error, _shareTermsFunction): self.setError("'%s'"%rpl(term)+" "+\ _("incorrect")) self.setError(\ - _("Value function is not version")) + _("Function value is not version")) return False verFile, verVar = self._convertVers(vals[1],valVars) res = dictRuleFunc[sepF](verVar,verFile) @@ -567,7 +567,7 @@ class fileHeader(_terms): foundTerm = True errorMsg = _("Incorrect template") +\ ": "+ templateName +"\n"+\ - _("header template not valid")+\ + _("template header not valid")+\ ": "+ i if function: rezTerm = self._equalTerm(i, @@ -714,7 +714,7 @@ class dirHeader(_terms): foundTerm = True errorMsg = _("Incorrect template") +\ ": "+ templateName +"\n"+\ - _("header template not valid")+ ": "+ i + _("template header not valid")+ ": "+ i if function: rezTerm = self._equalTerm(i, errorMsg, function) @@ -2103,7 +2103,8 @@ class _file(_error): try: self.F_CONF.write(self.textConfig) except: - self.setError(_("not open file:" ) + self.nameFileConfig) + self.setError(_("unable to open the file:" ) + + self.nameFileConfig) return False self.F_CONF.flush() return True @@ -2114,7 +2115,7 @@ class _file(_error): try: F_TEMPL = open(nameFileTemplate, "r") except: - self.setError(_("not open file:" ) + nameFileTemplate) + self.setError(_("unable to open the file:" ) + nameFileTemplate) return False return F_TEMPL @@ -2140,7 +2141,7 @@ class _file(_error): try: F_CONF = open(nameFileConfig, "w+") except: - self.setError(_("not open file:" ) + nameFileConfig) + self.setError(_("unable to open the file:" ) + nameFileConfig) return False return F_CONF @@ -2396,7 +2397,7 @@ class _shareTemplate: gid = pwdObj.pw_gid homeDir = pwdObj.pw_dir except: - cl_overriding.printERROR(_("Can not found user %s")%str(userName)) + cl_overriding.printERROR(_("User %s not found")%str(userName)) cl_overriding.exit(1) if groupsInfo: import grp @@ -2404,7 +2405,7 @@ class _shareTemplate: groupName = grp.getgrgid(gid).gr_name except: cl_overriding.printERROR(\ - _("Can not found group id %s")%str(gid)) + _("Id of group %s not found")%str(gid)) cl_overriding.exit(1) groupsNames = map(lambda x: x.gr_name,\ filter(lambda x: userName in x.gr_mem, grp.getgrall())) @@ -2547,7 +2548,8 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): except: self.printErrTemplate() cl_overriding.printERROR(\ - _("error var %s not int")%str(strNum)) + _("error, variable %s not a number")% + str(strNum)) cl_overriding.exit(1) elif self.objVar.exists(strNum): try: @@ -2555,19 +2557,21 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): except: self.printErrTemplate() cl_overriding.printERROR(\ - _("error var %s not int")%str(strNum)) + _("error, variable %s not a number")% + str(strNum)) cl_overriding.exit(1) else: self.printErrTemplate() cl_overriding.printERROR(\ - _("error local var %s not defined")%str(strNum)) + _("error, local variable %s is not defined")% + str(strNum)) cl_overriding.exit(1) if minus: num = -num strNumers.append(num) return sum(strNumers) self.printErrTemplate() - cl_overriding.printERROR(_("error template term %s, incorrect data")\ + cl_overriding.printERROR(_("error, template term %s, incorrect data")\ %str(term)) cl_overriding.exit(1) @@ -2634,7 +2638,7 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): else: self.printErrTemplate() cl_overriding.printERROR(\ - _("Second argument function is not 'root'")) + _("The second argument of the function is not 'root'")) cl_overriding.exit(1) if fileName[0] == "~": # Получаем директорию пользователя @@ -2679,14 +2683,14 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): else: self.printErrTemplate() cl_overriding.printERROR(\ - _("Third argument function is not 'root'")) + _("The third argument of the function is not 'root'")) cl_overriding.exit(1) if lenTerms >= 2: if not terms[0] in ["ver","num","char","key","empty"]: self.printErrTemplate() cl_overriding.printERROR(\ - _("first argument function is not 'ver' or 'num' or 'char'" - " or 'empty'")) + _("the first argument of the function is not " + "'ver' or 'num' or 'char' or 'empty'")) cl_overriding.exit(1) if lenTerms == 1: @@ -2811,14 +2815,15 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): if not terms[0] in fArgvNames: self.printErrTemplate() cl_overriding.printERROR(\ - _("first argument function must be 'num','pas' or 'uuid'")) + _("the first argument of the function " + "must be 'num','pas' or 'uuid'")) cl_overriding.exit(1) try: lenStr = int(terms[1]) except: self.printErrTemplate() cl_overriding.printERROR(\ - _("two argument function is not number")) + _("the second argument of the function is not a number")) cl_overriding.exit(1) choiceStr = fArgvNames[terms[0]] replace = ''.join([random.choice(choiceStr) for i in xrange(lenStr)]) @@ -2844,15 +2849,16 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): fArgvNames = ['upper','lower','capitalize'] if not terms[0] in fArgvNames: self.printErrTemplate() - cl_overriding.printERROR(_("first argument function is not 'upper' \ -or 'lower' or 'capitalize'")) + cl_overriding.printERROR(_("the first argument of the function is " + "not 'upper' or 'lower' or 'capitalize'")) cl_overriding.exit(1) try: strValue = str(self.objVar.Get(terms[1])) except: cl_overriding.printERROR(_("error in template %s")\ %self.nameTemplate) - cl_overriding.printERROR(_("error var %s not found")%str(terms[1])) + cl_overriding.printERROR(_("error, variable %s not found")% + str(terms[1])) cl_overriding.exit(1) replace = "" strValue = _toUNICODE(strValue) @@ -2892,14 +2898,14 @@ or 'lower' or 'capitalize'")) self.stackGlobalVars.append(str(value)) else: self.printErrTemplate() - cl_overriding.printERROR(_("error var %s exists")\ + cl_overriding.printERROR(_("error, variable %s exists")\ %str(nameLocVar)) cl_overriding.exit(1) else: # Если переменная не существует if len(terms) == 1: self.printErrTemplate() - cl_overriding.printERROR(_("error var %s not exists")\ + cl_overriding.printERROR(_("error, variable %s does not exist")\ %str(nameLocVar)) cl_overriding.exit(1) elif len(terms) == 2: @@ -2929,7 +2935,7 @@ or 'lower' or 'capitalize'")) else: self.printErrTemplate() cl_overriding.printERROR(\ - _("error, gloval variables stack is empty")) + _("error, global variables stack is empty")) cl_overriding.exit(1) else: self.printErrTemplate() @@ -3036,8 +3042,8 @@ or 'lower' or 'capitalize'")) elif len(terms) == 3: if not terms[2] in ['url','purl','unicode']: self.printErrTemplate() - cl_overriding.printERROR(_("third argument function is not " - "'url' or 'purl' or 'unicode'")) + cl_overriding.printERROR(_("the third argument of the function" + " is not 'url' or 'purl' or 'unicode'")) cl_overriding.exit(1) if terms[1]: self.printErrTemplate() @@ -3276,13 +3282,13 @@ or 'lower' or 'capitalize'")) pass if not flagFoundVar: # Если переменная не существует - cl_overriding.printERROR(_("error var %s not exists")\ + cl_overriding.printERROR(_("error, variable %s does not exist")\ %str(nameLocVar)) self.printErrTemplate() cl_overriding.exit(1) if not type(value) in (list,tuple): # Значение переменной не список или кортеж - cl_overriding.printERROR(_("value of %s is not a list or tuple")\ + cl_overriding.printERROR(_("value of %s is not a list or a tuple")\ %str(nameLocVar)) self.printErrTemplate() cl_overriding.exit(1) @@ -3292,7 +3298,7 @@ or 'lower' or 'capitalize'")) else: replace = "" except: - cl_overriding.printERROR(_("%s wrong")%strIndex) + cl_overriding.printERROR(_("wrong %s")%strIndex) self.printErrTemplate() cl_overriding.exit(1) textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\ @@ -3317,7 +3323,7 @@ or 'lower' or 'capitalize'")) mountPoint = terms[0] lastElementVar = terms[1] if not mountPoint or mountPoint[:1] !="/": - cl_overriding.printERROR(_("%s wrong")%lastElementVar) + cl_overriding.printERROR(_("wrong %s")%lastElementVar) self.printErrTemplate() cl_overriding.exit(1) nameVar = "os_install_disk_mount" @@ -3325,7 +3331,8 @@ or 'lower' or 'capitalize'")) valueVar = self.objVar.Get(nameVar) except: # Если переменная не существует - cl_overriding.printERROR(_("error var %s not exists")%nameVar) + cl_overriding.printERROR(_("error, variable %s does not exist")% + nameVar) self.printErrTemplate() cl_overriding.exit(1) nameElementVar = "os_install_disk_%s"%lastElementVar @@ -3337,20 +3344,20 @@ or 'lower' or 'capitalize'")) try: valueElementVar = self.objVar.Get(nameElementVar) except: - cl_overriding.printERROR(_("%s wrong")%lastElementVar) - cl_overriding.printERROR(_("error var %s not exists")\ + cl_overriding.printERROR(_("wrong %s")%lastElementVar) + cl_overriding.printERROR(_("error, variable %s does not exist")\ %nameElementVar) self.printErrTemplate() cl_overriding.exit(1) if not type(valueVar) in (list,tuple): # Значение переменной не список или кортеж - cl_overriding.printERROR(_("value of %s is not a list or tuple")\ + cl_overriding.printERROR(_("value of %s is not a list or a tuple")\ %nameVar) self.printErrTemplate() cl_overriding.exit(1) if not type(valueElementVar) in (list,tuple): # Значение переменной не список или кортеж - cl_overriding.printERROR(_("value of %s is not a list or tuple")\ + cl_overriding.printERROR(_("value of %s is not a list or a tuple")\ %nameElementVar) self.printErrTemplate() cl_overriding.exit(1) @@ -3371,8 +3378,8 @@ or 'lower' or 'capitalize'")) index = num break if index is None: - cl_overriding.printERROR(_("in the value of the variable \ -os_disk_install not found mount point '\' and '\%s'")%mountPoint) + cl_overriding.printERROR(_("mount point '\\' or '\\%s' not found " + "in the value of variable os_disk_install")%mountPoint) self.printErrTemplate() cl_overriding.exit(1) replace = valueElementVar[index] @@ -3421,7 +3428,7 @@ os_disk_install not found mount point '\' and '\%s'")%mountPoint) def printErrTemplate(self): """Печать ошибки при обработке функций шаблона""" cl_overriding.printERROR(_("error in template %s")%self.nameTemplate) - cl_overriding.printERROR(_("error template term '%s'")\ + cl_overriding.printERROR(_("error, template term '%s'")\ %str(self.functText)) def applyFuncTemplate(self, textTemplate, nameTemplate): @@ -3452,7 +3459,7 @@ os_disk_install not found mount point '\' and '\%s'")%mountPoint) else: self.printErrTemplate() cl_overriding.printERROR(\ - _("can not found template function '%s'")\ + _("function of templates '%s' not found")\ %str(self.functText)) cl_overriding.exit(1) @@ -3539,7 +3546,7 @@ class template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate): self.__titleHead = "--------------------------------------\ ----------------------------------------" self._titleBody = "" - self._titleList = ("Modified", "Processed template files" + ":") + self._titleList = ("Modified", "Processing template files" + ":") self._reVar = re.compile(("%s[a-zA-Z0-9_-]+%s")%(self.varStart, self.varEnd),re.M) # Условия @@ -3625,7 +3632,7 @@ re.M|re.S) try: res = string.atoi(strOct, 8) except ValueError: - self.setError(_("Not valid oct value: ") + str(strOct)) + self.setError(_("Invalid oct value: ") + str(strOct)) return False return res else: @@ -3664,7 +3671,7 @@ re.M|re.S) try: dUid,dGid = getModeFile(prevDir,"owner") except OSError: - self.setError(_("Not access dir: " ) + prevDir) + self.setError(_("No access to the directory: " ) + prevDir) return False if not mode is False: dMode = mode @@ -3682,7 +3689,8 @@ re.M|re.S) os.mkdir(nameDir) os.chown(nameDir, dUid, dGid) except: - self.setError(_("Can not create dir: " ) + nameDir) + self.setError(_("Failed to create the directory: " ) + + nameDir) return False try: if dMode: @@ -3693,7 +3701,7 @@ re.M|re.S) os.chown(dirName, dUid, dGid) createDirs.append(dirName) except: - self.setError(_("Can not create dir: " ) + dirName) + self.setError(_("Failed to create the directory: " ) + dirName) return False return createDirs @@ -3735,7 +3743,7 @@ re.M|re.S) parent = "" term = resS.group("rTerm") + parent +\ resS.group("lTerm") - if self._equalTerm(term, _("content template not valid: ")+\ + if self._equalTerm(term, _("invalid template content: ")+\ nameTemplate, function): textTemplateTmp = textTemplateTmp.replace(mark, body+end) else: @@ -3752,7 +3760,7 @@ re.M|re.S) if len(spFile)>1: flagTrue = False for term in spFile[1:]: - if self._equalTerm(term, _("name template not valid: ")+\ + if self._equalTerm(term, _("invalid template name: ")+\ fileTemplate): flagTrue = True break @@ -3763,7 +3771,7 @@ re.M|re.S) else: return True else: - self.setError(_("name template not valid: ")+ str(fileTemplate)) + self.setError(_("invalid template name: ")+ str(fileTemplate)) return False def getTitle(self, comment, commentList, configPath=""): @@ -3905,24 +3913,24 @@ re.M|re.S) setWARNING = lambda x: self.setWarning(x) and\ self.printWarning and\ printObj.printWARNING(x) - setWARNING(_("No conditions of checking a value of the \ -variable 'cl_name'")) + setWARNING(_("No conditions of checking the value of " + "variable 'cl_name'")) skipDirTemplates = [] for skipDir in skipDirs: skipTempl = os.path.join(skipDir,self.templDirNameFile) if os.path.isfile(skipTempl): skipDirTemplates.append(skipTempl) if skipTemplates or skipDirTemplates: - setWARNING(_("Skip templates:")) + setWARNING(_("Skipped templates:")) for skipTemplate in skipTemplates + skipDirTemplates: setWARNING(" "*6 + skipTemplate) if skipDirs: - setWARNING(_("Skip directories:")) + setWARNING(_("Skipped directories:")) for skipDir in skipDirs: setWARNING(" "*6 + skipDir) setWARNING("") - setWARNING(_("Headers directory and template files first level "\ - "should include of the 'cl_name' variable.")) + setWARNING(_("Headers of directory templates and headers of files " + "on the first level should include 'cl_name' variable.")) setWARNING(_("Example:")) setWARNING("# Calculate cl_name==calculate-install") return skipDirs + skipTemplates @@ -3949,7 +3957,7 @@ variable 'cl_name'")) return dictTemplates if not self.objVar.defined("cl_template_path"): - self.setError(_("not defined Var: ") + "cl_template_path") + self.setError(_("undefined variable: ") + "cl_template_path") return False dirsTemplates = self.objVar.Get("cl_template_path") dirsTemplates.sort() @@ -4214,7 +4222,7 @@ variable 'cl_name'")) textTemplate = FD.read() FD.close() except: - self.setError(_("Error open template") + ": " +\ + self.setError(_("Error in opening template") + ": " +\ templateDirFile) return ("", False, []) @@ -4245,7 +4253,7 @@ variable 'cl_name'")) path = os.path.join(self.homeDir, path.partition("/")[2],"")[:-1] elif not path or path and path[0] != "/": - self.setError(_("False value 'path' in template") + ": " +\ + self.setError(_("Wrong value 'path' in the template") + ": " +\ templateDirFile) return ("", False, []) else: @@ -4255,7 +4263,7 @@ variable 'cl_name'")) if "name" in objHead.params: nameDir = objHead.params['name'] if "/" in nameDir or nameDir == ".." or nameDir == ".": - self.setError(_("False value 'name' in template") + ": " +\ + self.setError(_("Wrong value 'name' in the template") + ": " +\ templateDirFile) return ("", False, []) # Новый путь к директории @@ -4274,7 +4282,7 @@ variable 'cl_name'")) try: removeDir(applyDir) except: - self.setError(_("Can not delete dir: " ) +\ + self.setError(_("Failed to delete the directory: " ) +\ applyDir) return ("", False, []) @@ -4288,13 +4296,14 @@ variable 'cl_name'")) try: removeDir(removePath) except: - self.setError(_("Can not delete dir: " ) +\ + self.setError( + _("Failed to delete the directory: ") +\ removePath) else: try: os.unlink(removePath) except: - self.setError(_("Can not delete: " ) + removePath) + self.setError(_("Failed to delete: " ) + removePath) return ("", False, []) # Созданные директории @@ -4312,7 +4321,7 @@ variable 'cl_name'")) else: os.chmod(applyDir, mode) else: - self.setError(_("False value 'chmod' in template") + ": " +\ + self.setError(_("Wrong value 'chmod' in the template") + ": " +\ templateDirFile) return ("", False, []) # chown - изменяем владельца и группу @@ -4326,8 +4335,9 @@ variable 'cl_name'")) try: uid = pwd.getpwnam(strUid).pw_uid except: - self.setError(_("Not user in this system: ") + strUid) - self.setError(_("False value 'chown' in template")+\ + self.setError(_("No such user on the system: ") + + strUid) + self.setError(_("Wrong value 'chown' in the template")+\ ": " + templateDirFile) return ("", False, []) gid = self.getGidFromGroup(strGid) @@ -4335,8 +4345,9 @@ variable 'cl_name'")) import grp gid = grp.getgrnam(strGid).gr_gid except: - self.setError(_("Not group in this system: ")+strGid) - self.setError(_("False value 'chown' in template") +\ + self.setError(_("Group not found on the system: ") + +strGid) + self.setError(_("Wrong value 'chown' in the template")+\ ": "+ templateDirFile) return ("", False, []) @@ -4351,11 +4362,11 @@ variable 'cl_name'")) templateDirFile): return ("", False, []) else: - self.setError(_("False value 'chown' in template") + ": " +\ - templateDirFile) + self.setError(_("Wrong value 'chown' in the template") + + ": " + templateDirFile) return ("", False, []) else: - self.setError(_("False value 'chown' in template") + ": " +\ + self.setError(_("Wrong value 'chown' in the template") + ": " +\ templateDirFile) return ("", False, []) else: @@ -4472,7 +4483,7 @@ variable 'cl_name'")) self.nameFileTemplate = os.path.abspath(nameFileTemplate) self.F_TEMPL = self.openTemplFile(self.nameFileTemplate) if not self.F_TEMPL: - self.setError(_("Error open template") + ": " +\ + self.setError(_("Error in opening template") + ": " +\ templateDirFile) return False self.textTemplate = self.F_TEMPL.read() @@ -4496,7 +4507,7 @@ variable 'cl_name'")) # Получаем путь с заменой ~ на директорию пользователя path = os.path.join(self.homeDir,path.partition("/")[2],"")[:-1] elif not path or path and path[0] != "/": - self.setError(_("False value 'path' in template") + ": " +\ + self.setError(_("Wrong value 'path' in the template") + ": " +\ nameFileTemplate) return ([], False) else: @@ -4507,7 +4518,7 @@ variable 'cl_name'")) if objHeadNew.params.has_key("name"): nameFile = objHeadNew.params['name'] if "/" in nameFile or nameFile == ".." or nameFile == ".": - self.setError(_("False value 'name' in template") + ": " +\ + self.setError(_("Wrong value 'name' in the template") + ": " +\ nameFileTemplate) return ([], False) # Новый путь к оригинальному файлу @@ -4525,13 +4536,13 @@ variable 'cl_name'")) if "exec" in objHeadNew.params: execPath = objHeadNew.params['exec'] if not os.access(execPath,os.X_OK): - self.setError(_("False value 'exec' in template") + ": " +\ + self.setError(_("Wrong value 'exec' in the template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute %s") %execPath) + self.setError(_("Failed to execute %s") %execPath) return ([], False) if typeAppendTemplate == "join": - self.setError(_("False value 'append=join' in template") + ": " +\ - nameFileTemplate) + self.setError(_("Wrong value 'append=join' in the template") +\ + ": " + nameFileTemplate) return ([], False) # Очищаем оригинальный файл @@ -4539,9 +4550,9 @@ variable 'cl_name'")) try: open(pathOldFile, "w").truncate(0) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not clear file") + ": " +\ + self.setError(_("Failed to clear the file") + ": " +\ pathOldFile) return (applyFiles, False) # Удаляем оригинальный файл @@ -4551,9 +4562,9 @@ variable 'cl_name'")) try: os.unlink(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete link") + ": " +\ + self.setError(_("Failed to delete the link") + ": " +\ pathOldFile) return ([], False) if os.path.isfile(pathOldFile): @@ -4561,9 +4572,9 @@ variable 'cl_name'")) try: os.remove(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete file") + ": " +\ + self.setError(_("Failed to delete the file") + ": " +\ pathOldFile) return ([], False) return (applyFiles, False) @@ -4582,9 +4593,9 @@ variable 'cl_name'")) try: os.unlink(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete link") + ": " +\ + self.setError(_("Failed to delete the link") + ": " +\ pathOldFile) return ([], False) if os.path.isfile(pathOldFile): @@ -4592,9 +4603,9 @@ variable 'cl_name'")) try: os.remove(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete file") + ": " +\ + self.setError(_("Failed to delete the file") + ": " +\ pathOldFile) return ([], False) @@ -4610,10 +4621,10 @@ variable 'cl_name'")) try: os.remove(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete file") + ": " +\ - pathOldFile) + self.setError(_("Failed to delete the file") + \ + ": " + pathOldFile) return ([], False) elif not os.path.exists(pathOldFile): return ([], False) @@ -4630,18 +4641,18 @@ variable 'cl_name'")) F_CONF.close() fMode, fUid, fGid = getModeFile(templateFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not open file") + ": " +\ + self.setError(_("Failed to open the file") + ": " +\ templateFile) return ([], False) if os.path.exists(pathOldFile): try: os.remove(pathOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete file") + ": " +\ + self.setError(_("Failed to delete the file") + ": " +\ pathOldFile) return ([], False) if foundTemplateFile: @@ -4650,9 +4661,9 @@ variable 'cl_name'")) FD.write(buff) FD.close() except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not create file") + " '%s'"\ + self.setError(_("Failed to create the file") + " '%s'"\ %pathOldFile) return ([], False) oMode = getModeFile(pathOldFile, mode="mode") @@ -4673,9 +4684,10 @@ variable 'cl_name'")) try: os.chdir(pathLink) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not change the current directory to")+\ + self.setError( + _("Failed to change the current directory to")+\ " " + pathLink) return ([], False) @@ -4687,7 +4699,7 @@ variable 'cl_name'")) preReturn(pathProg) return ([], False) else: - self.setError(_("False value 'chmod' in template") + ": " +\ + self.setError(_("Wrong value 'chmod' in the template") + ": " +\ nameFileTemplate) preReturn(pathProg) return ([], False) @@ -4706,9 +4718,10 @@ variable 'cl_name'")) if uid is None: uid = pwd.getpwnam(strUid).pw_uid except: - self.setError(_("Not user in this system: ") + + self.setError(_("No such user on the system: ") + strUid) - self.setError(_("False value 'chown' in template") + + self.setError( + _("Wrong value 'chown' in the template") + ": "+ nameFileTemplate) preReturn(pathProg) return ([], False) @@ -4721,9 +4734,10 @@ variable 'cl_name'")) import grp gid = grp.getgrnam(strGid).gr_gid except: - self.setError(_("Not group in this system: ") + + self.setError(_("Group not found on the system: ") + strGid) - self.setError(_("False value 'chown' in template") + + self.setError( + _("Wrong value 'chown' in the template") + ": "+ nameFileTemplate) preReturn(pathProg) return ([], False) @@ -4732,12 +4746,12 @@ variable 'cl_name'")) preReturn(pathProg) return ([], False) else: - self.setError(_("False value 'chown' in template") + ": " +\ - nameFileTemplate) + self.setError(_("Wrong value 'chown' in the template") + + ": " + nameFileTemplate) preReturn(pathProg) return ([], False) else: - self.setError(_("False value 'chown' in template") + ": " +\ + self.setError(_("Wrong value 'chown' in the template") + ": " +\ nameFileTemplate) preReturn(pathProg) return ([], False) @@ -4766,9 +4780,9 @@ variable 'cl_name'")) # иначе удаляем файл os.remove(prevOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not delete file") + ": " +\ + self.setError(_("Failed to delete the file") + ": " +\ prevOldFile) preReturn(pathProg) return ([], False) @@ -4779,9 +4793,9 @@ variable 'cl_name'")) try: os.symlink(pathOldFile, prevOldFile) except: - self.setError(_("Error in template") + ": " +\ + self.setError(_("Template error") + ": " +\ nameFileTemplate) - self.setError(_("Can not create symbolic link") + " :" +\ + self.setError(_("Failed to create a symbolic link") + " :" +\ "%s -> %s"%(prevOldFile, pathOldFile)) preReturn(pathProg) return ([], False) @@ -4928,22 +4942,22 @@ variable 'cl_name'")) if formatTemplate == "patch": if typeAppendTemplate != "patch": self.setError(\ - _("False option append=%(type)s in template %(file)s")\ + _("Wrong option append=%(type)s in template %(file)s")\ %{"type":typeAppendTemplate,"file":nameFileTemplate}) return False # создаем объект формата шаблона objTempl = self.getFormatObj(formatTemplate, self.textTemplate) if not objTempl: self.setError(\ - _("Incorrect header parmeter format=%s in template")\ - %formatTemplate + " " + nameFileTemplate) + _("Incorrect header parmeter format=%s in the template")\ + %formatTemplate + " " + nameFileTemplate) return False if objHeadOld and objHeadOld.body: self.textConfig = objHeadOld.body # обработка конфигурационного файла self.textTemplate = objTempl.processingFile(self.textConfig) if objTempl.getError(): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) return False if execStr: @@ -4954,9 +4968,9 @@ variable 'cl_name'")) if 'exec' in objHeadNew.params: if not self.executeTemplate(self.nameFileConfig, objHeadNew.params['exec']): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute") + ": " +\ + self.setError(_("Failed to execute") + ": " +\ self.nameFileConfig) return False return False @@ -4976,12 +4990,12 @@ variable 'cl_name'")) self.textTemplate) if not objTemplNew: self.setError(\ - _("Incorrect header parmeter format=%s in template")\ - %formatTemplate + " " + nameFileTemplate) + _("Incorrect header parmeter format=%s in the template")\ + %formatTemplate + " " + nameFileTemplate) return False if "xml_" in formatTemplate: if objTemplNew.getError(): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) return False # Имя файла внутри xml xfce конфигурационных файлов @@ -5026,9 +5040,9 @@ variable 'cl_name'")) if 'exec' in objHeadNew.params: if not self.executeTemplate(self.nameFileConfig, objHeadNew.params['exec']): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute") + ": " +\ + self.setError(_("Failed to execute") + ": " +\ self.nameFileConfig) return False return False @@ -5037,7 +5051,7 @@ variable 'cl_name'")) elif typeAppendTemplate == "before": if "xml_" in formatTemplate: self.setError(\ - _("False option append=before in template %s")\ + _("Wrong option append=before in template %s")\ %nameFileTemplate) return False if objHeadOld and objHeadOld.body: @@ -5055,9 +5069,9 @@ variable 'cl_name'")) if 'exec' in objHeadNew.params: if not self.executeTemplate(self.nameFileConfig, objHeadNew.params['exec']): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute") + ": " +\ + self.setError(_("Failed to execute") + ": " +\ self.nameFileConfig) return False return False @@ -5066,7 +5080,7 @@ variable 'cl_name'")) elif typeAppendTemplate == "after": if "xml_" in formatTemplate: self.setError(\ - _("False option append=after in template %s")\ + _("Wrong option append=after in template %s")\ %nameFileTemplate) return False if objHeadOld and objHeadOld.body: @@ -5083,9 +5097,9 @@ variable 'cl_name'")) if 'exec' in objHeadNew.params: if not self.executeTemplate(self.nameFileConfig, objHeadNew.params['exec']): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute") + ": " +\ + self.setError(_("Failed to execute") + ": " +\ self.nameFileConfig) return False return False @@ -5097,20 +5111,20 @@ variable 'cl_name'")) self.textTemplate = objTxtCoder.encode(self.textTemplate) if formatTemplate =="raw": self.setError(\ - _("Incorrect header parmeter append=%s in template")\ - %typeAppendTemplate + " " + nameFileTemplate) + _("Incorrect header parmeter append=%s in the template")\ + %typeAppendTemplate + " " + nameFileTemplate) return False # создаем объект формата шаблона objTemplNew = self.getFormatObj(formatTemplate, self.textTemplate) if not objTemplNew: self.setError(\ - _("Incorrect header parmeter format=%s in template")\ - %formatTemplate + " " + nameFileTemplate) + _("Incorrect header parmeter format=%s in the template")\ + %formatTemplate + " " + nameFileTemplate) return False if "xml_" in formatTemplate: if objTemplNew.getError(): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) return False nameRootNode=nameFileConfig.rpartition("/")[2].split(".")[0] @@ -5145,7 +5159,7 @@ variable 'cl_name'")) return False if "xml_" in formatTemplate: if objTemplOld.getError(): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileConfig) return False nameRootNode=nameFileConfig.rpartition("/")[2].split(".")[0] @@ -5154,7 +5168,7 @@ variable 'cl_name'")) objTemplOld.join(objTemplNew) if "xml_" in formatTemplate: if objTemplOld.getError(): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) return False data = objTemplOld.getConfig().encode("UTF-8").split("\n") @@ -5175,19 +5189,19 @@ variable 'cl_name'")) if 'exec' in objHeadNew.params: if not self.executeTemplate(self.nameFileConfig, objHeadNew.params['exec']): - self.setError(_("False template") + ": " +\ + self.setError(_("Wrong template") + ": " +\ nameFileTemplate) - self.setError(_("Can not execute") + ": " +\ + self.setError(_("Failed to execute") + ": " +\ self.nameFileConfig) return False return False return filesApply else: - self.setError(_("False (type append) template") + ": " +\ + self.setError(_("Wrong (type append) template") + ": " +\ typeAppendTemplate) return False else: - self.setError(_("Type template not found: ") + nameFileTemplate) + self.setError(_("Template type not found: ") + nameFileTemplate) return False return filesApply @@ -5325,7 +5339,7 @@ class templateClt(scanDirectoryClt, template): if not self.flagApplyTemplates: return ([],[]) if not self.objVar.defined("cl_template_clt_path"): - self.setError(_("not defined Var: ") + "cl_template_clt_path") + self.setError(_("undefined variable: ") + "cl_template_clt_path") return False dirsTemplates = self.objVar.Get("cl_template_clt_path") dirsTemplates.sort() @@ -5398,7 +5412,8 @@ class iniParser(_error, templateFormat): def writeIniFile(self, txtConfig): if self.readOnly: - self.setError(_("Unable to write into file") + ": " + self.iniFile) + self.setError(_("Unable to write to the file") + + ": " + self.iniFile) return False if not os.path.exists(self.iniFile): try: @@ -5407,10 +5422,12 @@ class iniParser(_error, templateFormat): fcntl.flock(self.FD.fileno(), fcntl.LOCK_EX) os.chmod(self.iniFile, self.mode) except: - self.setError(_("Unable to create file") + ": " + self.iniFile) + self.setError(_("Unable to create the file") + + ": " + self.iniFile) return False if not self.FD: - self.setError(_("Unable to write into file") + ": " + self.iniFile) + self.setError(_("Unable to write to the file") + + ": " + self.iniFile) return False self.FD.truncate(0) self.FD.seek(0) @@ -5435,8 +5452,8 @@ class iniParser(_error, templateFormat): classObj = self.getClassObj("plasma") else: if nameFomat == "plasma": - self.setError(_("In the file %s (format - 'plasma'), "\ - "write the variable in the format 'samba'")\ + self.setError(_("Trying to write a variable of 'samba' format" + " to file %s (format - 'plasma')") %self.iniFile) return False # формат samba @@ -5487,7 +5504,7 @@ class iniParser(_error, templateFormat): try: objIni = self.getClassObj("plasma")(textIni) except: - self.setError(_("Incorrect format file") + ": " + \ + self.setError(_("Incorrect file format") + ": " + \ self.iniFile) self.checkIni = False return self.checkIni @@ -5540,8 +5557,8 @@ class iniParser(_error, templateFormat): formatPlasma = True else: if nameFomat == "plasma": - self.setError(_("In the file %s (format - 'plasma'), "\ - "get the variable in the format 'samba'")\ + self.setError(_("Trying to fetch a variable of 'samba' format" + " from file %s (format - 'plasma')")\ %self.iniFile) return False # формат samba @@ -5607,8 +5624,8 @@ class iniParser(_error, templateFormat): formatPlasma = True else: if nameFomat == "plasma": - self.setError(_("In the file %s (format - 'plasma'), "\ - "get all variables in the format 'samba'")\ + self.setError(_("Trying to fetch all variables of 'samba' " + "format from file %s (format - 'plasma')") %self.iniFile) return False # формат samba diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 351f80d..6e9d830 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -460,7 +460,7 @@ def str2dict(s): d[i] = replaceSlash(d[i]) return d else: - cl_overriding.printERROR(_("wrong dict value: %s"%s)) + cl_overriding.printERROR(_("wrong dictionary value: %s"%s)) cl_overriding.exit(1) def str2list(s): @@ -646,7 +646,8 @@ class SingletonParam(type): def __call__(cls,*args,**kw): keyarg = args[0] if args else "" if not keyarg in cls.instance: - cls.instance[keyarg] = super(SingletonParam, cls).__call__(*args, **kw) + cls.instance[keyarg] = \ + super(SingletonParam, cls).__call__(*args, **kw) return cls.instance[keyarg] class FStab(object): @@ -757,7 +758,7 @@ def getUserPassword(flag="dialog", pwDialog=False): if flag == "dialog": if not pwDialog: pwDialog = [_("New password"), - _("Retype new password")] + _("Retype the new password")] pwdA = getpass.getpass(pwDialog[0]+":") pwdB = getpass.getpass(pwDialog[1]+":") elif flag == "stdin": @@ -769,7 +770,7 @@ incorrect option 'flag=%s'")%flag) return False if not pwdA or not (pwdA == pwdB): cl_overriding.printERROR(_("ERROR") + ": " +\ - _("password incorrect")+ ": " + _("try again")) + _("wrong password")+ ": " + _("try again")) return False userPwd = pwdA return userPwd diff --git a/pym/client/progressbar.py b/pym/client/progressbar.py index 941bfa9..a559dbf 100644 --- a/pym/client/progressbar.py +++ b/pym/client/progressbar.py @@ -90,7 +90,8 @@ class GProgressBar(NoneProgressBar): '''Установить текущее значения для прогресса''' if self.pipein and value <= self.max: progress_value = int(value / self.kmax) - if progress_value > int(self.value / self.kmax) and progress_value < 100: + if progress_value > int(self.value / self.kmax) and \ + progress_value < 100: self._set(progress_value) self.value = value diff --git a/pym/encrypt.py b/pym/encrypt.py index 94b8164..d12e87c 100644 --- a/pym/encrypt.py +++ b/pym/encrypt.py @@ -63,7 +63,7 @@ class encrypt(color_print): """ if not password: self.printERROR(_("ERROR") + " getHashPasswd: " + - _("password empty")) + _("empty password")) return False hashPwd = "" @@ -113,11 +113,11 @@ class encrypt(color_print): else: if SecHashAlg in ("lm","nt"): self.printERROR(_("ERROR") + " getHashPasswd: " + - (_("Can not support '%s' crypto algorithm") + (_("Failed to support '%s' crypto algorithm") %SecHashAlg) + " " + _("without py-smbpasswd")) else: self.printERROR(_("ERROR") + " getHashPasswd: " + - _("Can not support '%s' crypto algorithm") + _("Failed to support '%s' crypto algorithm") %SecHashAlg) return False return hashPwd @@ -257,7 +257,7 @@ nsCertType = %(nsCertType)s def createCnfFile(self, textCnf): '''Generate openssl.cnf file''' if not os.path.exists(self.sslFile): - self.printERROR(_("Can not found %s")%self.sslFile) + self.printERROR(_("%s not found")%self.sslFile) return False strData = time.strftime("%Y%m%d%H%M%S",time.localtime(time.time())) cnfFileName = "%s.%s.cnf" %(strData,genpassword()) @@ -309,7 +309,7 @@ nsCertType = %(nsCertType)s try: pwdObj = pwd.getpwnam(userName) except: - self.printERROR(_("Not found user %s")%userName) + self.printERROR(_("User %s not found")%userName) return False uid = pwdObj.pw_uid gid = pwdObj.pw_gid @@ -411,7 +411,7 @@ nsCertType = %(nsCertType)s try: pwdObj = pwd.getpwnam(userName) except: - self.printERROR(_("Not found user %s")%userName) + self.printERROR(_("User %s not found")%userName) return False uid = pwdObj.pw_uid gid = pwdObj.pw_gid @@ -513,7 +513,7 @@ nsCertType = %(nsCertType)s try: pwdObj = pwd.getpwnam(userName) except: - self.printERROR(_("Not found user %s")%userName) + self.printERROR(_("User %s not found")%userName) return False uid = pwdObj.pw_uid gid = pwdObj.pw_gid @@ -540,7 +540,7 @@ nsCertType = %(nsCertType)s %(self.sslFile, cnfFile, sslDays, certFile, keyFile)) if textLine is False: - self.printERROR(_("Can not create certificate %s")%certFile) + self.printERROR(_("Failed to create certificate %s")%certFile) return False # Удаление конфигурационного файла if os.path.exists(cnfFile): @@ -574,7 +574,7 @@ nsCertType = %(nsCertType)s """ dirName = os.path.split(fileName)[0] if not os.path.exists(dirName): - self.printERROR(_("Path %s not exists") %dirName) + self.printERROR(_("Path %s does not exist") %dirName) return False fd = os.open(fileName, os.O_CREAT) os.close(fd) diff --git a/pym/format/patch.py b/pym/format/patch.py index 22f39a4..ba11f6b 100644 --- a/pym/format/patch.py +++ b/pym/format/patch.py @@ -57,7 +57,7 @@ class patch(_error): def processingFile(self, textConfigFile): """Обработка конфигурационного файла""" if not self.doc: - self.setError(_("Can not convert text template in XML")) + self.setError(_("Cannot convert the text template in XML")) return False retTextConfigFile = textConfigFile tags = ["reg", "text"] @@ -66,7 +66,7 @@ class patch(_error): for node in self.rootNode.childNodes: if node.nodeType==node.ELEMENT_NODE: if not node.tagName == tags[tagsIndex]: - self.setError(_("Incorrect text template")) + self.setError(_("Incorrect template text")) return False if tagsIndex == 1: tagsIndex = 0 @@ -79,23 +79,23 @@ class patch(_error): if reText is None: textNode = node.toxml().encode("UTF8") self.setError(\ - _("Incorrect text template")+ ": \n" +\ + _("Incorrect template text")+ ": \n" +\ "%s" %textNode) return False else: self.setError(\ - _("Incorrect text template ''")) + _("Incorrect text of template ''")) return False if not reText.strip(): self.setError(\ - _("Incorrect text template '%s'")\ + _("Incorrect text of template '%s'")\ %reText) return False try: regex = re.compile(reText) except: self.setError(\ - _("Incorrect text template '%s'")\ + _("Incorrect text of template '%s'")\ %reText) return False elif node.tagName == "text" and regex: @@ -104,7 +104,7 @@ class patch(_error): if text is None: textNode = node.toxml().encode("UTF8") self.setError(\ - _("Incorrect text template")+ ": \n" +\ + _("Incorrect template text")+ ": \n" +\ "%s" %textNode) return False else: diff --git a/pym/format/xml_gconf.py b/pym/format/xml_gconf.py index e581535..30c5370 100644 --- a/pym/format/xml_gconf.py +++ b/pym/format/xml_gconf.py @@ -122,7 +122,8 @@ class xml_gconf(xml_xfce): (found '<%(tag)s>..'")%{'tag':tagName}) return False if not n.hasAttribute("name"): - self.setError(_('Not found arrtibute "name" in tag entry')) + self.setError( + _("Arrtibute \"name\" not found in the tag entry")) return False flagType = n.hasAttribute("type") flagValue = False @@ -130,7 +131,8 @@ class xml_gconf(xml_xfce): if flagSchema: nSchema = n.getAttribute("schema") if not flagType and not flagSchema: - self.setError(_('Not found arrtibute "type" in tag entry')) + self.setError( + _("Arrtibute \"type\" not found in the tag entry")) return False nName = n.getAttribute("name") attrName = u"attribute::name='%s'"%nName @@ -268,7 +270,7 @@ the same nodes at one level") try: self.joinDoc(xml_gconfObj.doc) except: - self.setError(_("Can not join template")) + self.setError(_("Failed to join the template")) return False return True diff --git a/pym/format/xml_gconf_tree.py b/pym/format/xml_gconf_tree.py index f1d522e..5d23f09 100644 --- a/pym/format/xml_gconf_tree.py +++ b/pym/format/xml_gconf_tree.py @@ -186,6 +186,6 @@ the same nodes at one level") try: self.joinDoc(xml_gconfObj.doc) except: - self.setError(_("Can not join template")) + self.setError(_("Failed to join the template")) return False return True \ No newline at end of file diff --git a/pym/format/xml_xfce.py b/pym/format/xml_xfce.py index de15868..0d0cd25 100644 --- a/pym/format/xml_xfce.py +++ b/pym/format/xml_xfce.py @@ -84,7 +84,7 @@ class xml_xfce(_error): try: self.joinDoc(xml_xfceObj.doc) except: - self.setError(_("Can not join template")) + self.setError(_("Failed to join the template")) return False return True diff --git a/pym/format/xml_xfcepanel.py b/pym/format/xml_xfcepanel.py index a2b28ac..392d650 100644 --- a/pym/format/xml_xfcepanel.py +++ b/pym/format/xml_xfcepanel.py @@ -193,7 +193,7 @@ the same nodes at one level") try: self.joinDoc(xml_xfceObj.doc) except: - self.setError(_("Can not join template")) + self.setError(_("Failed to join the template")) return False return True diff --git a/pym/server/ldap.py b/pym/server/ldap.py index e50a85f..e5196e1 100644 --- a/pym/server/ldap.py +++ b/pym/server/ldap.py @@ -51,7 +51,7 @@ def adminConnectLdap(fun): if self.clVars.defined("ld_base_dn"): self.baseDN = self.clVars.Get("ld_base_dn") if not self.baseDN: - self.printERROR (_('Not found LDAP base DN')) + self.printERROR (_("Base DN not found for LDAP")) if flagError: return False else: @@ -93,7 +93,7 @@ class ldapFunction(ldapFun): return False return True else: - self.setError(_("No connect to LDAP server")) + self.setError(_("Unable to connect to the LDAP server")) return False @@ -173,7 +173,7 @@ class shareldap(_error, color_print, shareVars): else: service = part self.printERROR(\ - _("Admin password for the service %s could not be found")%service) + _("Admin password for service %s could not be found")%service) return False ldapObj = ldapFunction(adminDn, adminPw) # Генератор задержек @@ -194,7 +194,7 @@ class shareldap(_error, color_print, shareVars): if not e in listError: listError.append(e) _error.error = listError - self.printERROR (_("LDAP connect error") + ": " +\ + self.printERROR (_("LDAP connection error") + ": " +\ ldapObj.getError().strip()) return False # Устанавливаем у объекта соединение и объект LDAP функций @@ -224,7 +224,7 @@ class shareldap(_error, color_print, shareVars): if not e in listError: listError.append(e) _error.error = listError - self.printERROR (_("LDAP connect error") + ": " +\ + self.printERROR (_("LDAP connection error") + ": " +\ ldapObj.getError().strip()) return False # Устанавливаем у объекта соединение и объект LDAP функций @@ -408,7 +408,7 @@ class shareldap(_error, color_print, shareVars): # Код возврата retcode = pipe.wait() if retcode != 0: - self.printERROR(_("Can not convert file '%s' in jpeg format")\ + self.printERROR(_("Cannot convert file '%s' in jpeg format")\ %photoPath) flagError = True fErr.close() @@ -416,7 +416,7 @@ class shareldap(_error, color_print, shareVars): photoData = fOut.read() if not stringIsJpeg(photoData): self.printERROR(\ - _("Can not convert file '%s' in jpeg format") %photoPath) + _("Cannot convert file '%s' in jpeg format") %photoPath) flagError = True fOut.close() if flagError: diff --git a/pym/server/share.py b/pym/server/share.py index 23b6c44..ddb0ff1 100644 --- a/pym/server/share.py +++ b/pym/server/share.py @@ -80,7 +80,7 @@ class shareVars: if not value.strip(): self.clVars.Delete(name) if not self.clVars.Write(name,value,True,"remote","client"): - self.printERROR(_("Error writing variable %s")%name) + self.printERROR(_("Error in writing variable %s")%name) flagError = True break if flagError: @@ -112,7 +112,7 @@ class servicesAPI(color_print): classImport = getattr(__import__("cl_ldap", globals(),\ locals(),[]), serviceName) except (ImportError, AttributeError): - self.printERROR(_("Can not found service class '%s'")\ + self.printERROR(_("Class of service '%s' not found")\ %serviceName) return False __imports_classes__[serviceName] = classImport diff --git a/pym/server/users.py b/pym/server/users.py index 94bfb7a..0942a5c 100644 --- a/pym/server/users.py +++ b/pym/server/users.py @@ -22,7 +22,8 @@ import types from cl_utils import removeDir from cl_print import color_print from server.share import servicesAPI -from server.utils import rawInput, isCorrectStringNet, addInfoUser, addInfoGroup, dialogYesNo +from server.utils import rawInput, isCorrectStringNet, addInfoUser, \ + addInfoGroup, dialogYesNo # Перевод модуля import cl_lang tr = cl_lang.lang() @@ -128,13 +129,13 @@ in a sambaDomainName', try: uid = pwd.getpwnam(userName)[2] except: - self.printERROR(_("Can not found user %s in this system")%userName) + self.printERROR(_("User %s not found on this system")%userName) return () try: import grp gid = grp.getgrnam(groupName)[2] except: - self.printERROR(_("Can not found group %s in this system")\ + self.printERROR(_("Group %s not found on this system")\ %groupName) return () return (uid, gid) @@ -166,10 +167,11 @@ in a sambaDomainName', try: copyDir(srcDir, delBackDir) except: - self.printERROR(_("Not restore user data in dir %s")\ + self.printERROR( + _("Failed to restore user data in directory %s")\ %srcDir) return False - self.printSUCCESS(_("Restore user data in dir %s")\ + self.printSUCCESS(_("Restore user data is in directory %s")\ %srcDir) return "Yes", delBackDir elif dialogRes == False: @@ -231,9 +233,10 @@ in a sambaDomainName', "%s-%s"%(userName,strUid), service) if os.path.exists(delBackDir) and os.listdir(delBackDir): - self.printERROR(_("Found deleted user data dir %s")\ + self.printERROR(_("Found deleted user data in directory %s")\ %delBackDir) - self.printERROR(_("Not created deleted user data dir %s")\ + self.printERROR(_("Unable to create directory %s for storing " + "deleted user data")\ %delBackDir) return False else: @@ -255,17 +258,19 @@ in a sambaDomainName', try: copyDir(delBackDir,srcDir) except: - self.printERROR(_("Can not copy deleted user data in dir %s")\ + self.printERROR( + _("Failed to copy deleted user data in directory %s")\ %delBackDir) return False - self.printSUCCESS(_("Created deleted user data dir %s")\ + self.printSUCCESS( + _("Created a directory for storing deleted user data")\ %delBackDir) return True def removeEmptyDir(self, rmDir): """Удаление пустых директорий""" if not os.path.exists(rmDir): - self.printERROR(_("Not found remove dir %s") %rmDir) + self.printERROR(_("Directory %s, to be removed, not found") %rmDir) return False rDir = rmDir while os.listdir(rDir) == []: @@ -294,7 +299,7 @@ in a sambaDomainName', """ userDir = os.path.split(fileName)[0] if not os.path.exists(userDir): - self.printERROR(_("Path %s not exists") %userDir) + self.printERROR(_("Path %s does not exist") %userDir) return False fd = os.open(fileName, os.O_CREAT) os.close(fd) @@ -312,7 +317,8 @@ in a sambaDomainName', вывод - список доверительных сетей """ def printW(): - cl_overriding.printSUCCESS(_("Incorrect string allow networks")) + cl_overriding.printSUCCESS( + _("Incorrect string of available networks")) cl_overriding.printSUCCESS(\ _("Example - allow networks: 10.0.0.0/24 10.0.10.0/24")) cl_overriding.printSUCCESS(_("Try again\n")) diff --git a/pym/update_config/cl_update_config.py b/pym/update_config/cl_update_config.py index 2802e59..31330b1 100644 --- a/pym/update_config/cl_update_config.py +++ b/pym/update_config/cl_update_config.py @@ -218,7 +218,7 @@ class updateUserConfigs(shareUpdateConfigs): filter(lambda y: y, x.split(" "))), resWho)))))) else: - self.printERROR(_("Can not execute 'who'")) + self.printERROR(_("Failed to execute 'who'")) return False return xUsers @@ -245,7 +245,7 @@ class updateUserConfigs(shareUpdateConfigs): set(self.getConfiguredPasswdUsers()))) if not xUsers: self.logger.info(_("Package %s") %nameProgram) - self.logger.warn(_("Not found X sessions users")) + self.logger.warn(_("X sessions users not found")) return True self.logger.info(_("Package %s") %nameProgram) self.logger.info(_("Update desktop configuration files")) @@ -273,7 +273,7 @@ class updateUserConfigs(shareUpdateConfigs): dirsFiles = clTempl.applyTemplates() if dirsFiles is False: self.printERROR(\ - _("Error using templates for the user %s")\ + _("Error in using templates for the user %s")\ %userName) for errMess in clTempl.getError().splitlines(): self.printERROR(errMess) @@ -288,14 +288,15 @@ class updateUserConfigs(shareUpdateConfigs): sorted(list(set(dirsFiles[1]))))) if dictPakkages: for calcPkg in listIndex: - self.printWARNING(_("Package %s has changed files")\ + self.printWARNING( + _("Package %s has changed the following files")\ %calcPkg+":") for userName, configFiles in dictPakkages[calcPkg]: self.printWARNING(" "*2 + _("User %s")%userName + ":") for nameConfigFile in configFiles: self.printWARNING(" "*5 + nameConfigFile) if not dictPakkages: - self.logger.warn(_("Not found templates")) + self.logger.warn(_("Templates not found")) return True class updateSystemConfigs(shareUpdateConfigs): @@ -367,7 +368,7 @@ class updateSystemConfigs(shareUpdateConfigs): """Копирование конфигурационных файлов""" configDstFiles = self.scanProtectDirs(configPath) if configDstFiles: - self.logger.warn(_("Replace files:")) + self.logger.warn(_("Replaced files:")) for dst in configDstFiles: src = pathJoin(configPath, dst) if src != dst: @@ -435,7 +436,7 @@ class updateSystemConfigs(shareUpdateConfigs): dirsFiles = clTempl.applyTemplates() nameAndVerPkg = nameProg + "-"+clVars.Get("cl_ver") if dirsFiles is False: - self.printERROR(_("Error template in a package %s")\ + self.printERROR(_("Template error in package %s")\ %nameAndVerPkg) for errMess in clTempl.getError().splitlines(): self.printERROR(errMess) @@ -453,7 +454,8 @@ class updateSystemConfigs(shareUpdateConfigs): sorted(list(set(dirsFiles[1]))) if dictPakkages: for calcPkg in listIndex: - self.printWARNING(_("Package %s has changed files")%calcPkg+":") + self.printWARNING( + _("Package %s has changed the following files")%calcPkg+":") for nameF in dictPakkages[calcPkg]: nameFile = nameF.partition(configPath)[2] if nameFile: @@ -463,7 +465,7 @@ class updateSystemConfigs(shareUpdateConfigs): nameFile = nameF self.printWARNING(" "*5 + nameFile) else: - self.logger.warn(_("Not found templates")) + self.logger.warn(_("Templates not found")) if flagUpdate: self.copyConfigFiles(configPath) if clTempl and clTempl.getWarning(): diff --git a/pym/update_config/cl_update_config_cmd.py b/pym/update_config/cl_update_config_cmd.py index 33e3181..fbdd538 100644 --- a/pym/update_config/cl_update_config_cmd.py +++ b/pym/update_config/cl_update_config_cmd.py @@ -37,7 +37,7 @@ EXAMPLES = _(r"%prog --system --pkg_category net-nds --pkg_version 2.4.19\ --path / openldap") # Описание программы (что делает программа) -DESCRIPTION = _("Update configuration files package installed") +DESCRIPTION = _("Update configuration files during package installation") # Опции командной строки CMD_OPTIONS=[{'longOption':"system", diff --git a/pym/utils/ip.py b/pym/utils/ip.py index 2ec2852..37ba88f 100644 --- a/pym/utils/ip.py +++ b/pym/utils/ip.py @@ -130,10 +130,10 @@ def getIpNet(ip,mask=None,cidr=None): def isIpInNet(checkip,*ipnets): """Check is ip in specified nets""" return map(lambda x:x[0], - filter(lambda x:strIpToIntIp(checkip)&x[2] == strIpToIntIp(x[1])&x[2], - map(lambda x:(x[0],x[1][0],strIpToIntIp(cidrToMask(int(x[1][1])))), - map(lambda x:(x,x.partition('/')[0::2]), - ipnets)))) + filter(lambda x:strIpToIntIp(checkip)&x[2] == strIpToIntIp(x[1])&x[2], + map(lambda x:(x[0],x[1][0],strIpToIntIp(cidrToMask(int(x[1][1])))), + map(lambda x:(x,x.partition('/')[0::2]), + ipnets)))) def receiveMac(interface="eth0"): """Get MAC from interface"""