From 46c52ed55a8451712a87262e407f978a9bd7b7c9 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 22 Apr 2014 10:56:34 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=20=D0=B2=D1=8B=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BE=D0=B1=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20choice=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлен комментарий к репозиторию distros --- calculate/lib/datavars.py | 19 ++++++++++++++----- calculate/lib/utils/text.py | 2 +- calculate/lib/variables/env.py | 9 +++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/calculate/lib/datavars.py b/calculate/lib/datavars.py index b5f2d33..905f889 100644 --- a/calculate/lib/datavars.py +++ b/calculate/lib/datavars.py @@ -394,13 +394,13 @@ class Variable: if "list" in self.type: if not type(value) in (list,tuple): raise VariableError( - _("Value for variable '{varname}' may be '{vartype}' only").format( + _("Value for variable '{varname}' may be {vartype} only").format( varname=self.label or self.name, vartype="list")) - error = _("Values for variable '{varname}' may be '{vartype}' only") + error = _("Values for variable '{varname}' may be {vartype} only") else: value = repeat(value,1) - error = _("Value for variable '{varname}' may be '{vartype}' only") + error = _("Value for variable '{varname}' may be {vartype} only") if "string" in self.type: value, valuecopy = tee(value,2) for v in (x for x in valuecopy if not type(x) in (str,unicode)): @@ -410,7 +410,7 @@ class Variable: return if "choice" in self.type: choiceVal = self.choice() - tipChoice = map(lambda x:'"%s"(%s)'%(x[1],x[0]) \ + tipChoice = map(lambda x:'"%s" [%s]'%(x[1],x[0]) \ if type(x) in (list,tuple) else str(x), choiceVal) if choiceVal and type(choiceVal[0]) in (tuple,list): choiceVal = [x[0] for x in choiceVal] @@ -418,10 +418,19 @@ class Variable: value = repeat(value,1) for recval in value: for val in recval: + name = self.label or self.name + if val == "list" and "choice" in self.type: + if "edit" in self.type: + if "list" in self.type: + error = _("Values for variable '{varname}' may " + "be {vartype}") + else: + error = _("Value for variable '{varname}' may be " + "{vartype}") + self.raiseWrongChoice(name, tipChoice, val, error) if "choice" in self.type and not "choiceedit" in self.type: if choiceVal and val and not val in choiceVal or \ val is None: - name = self.label or self.name if not choiceVal: self.raiseNothingValue() self.raiseWrongChoice(name,tipChoice,val,error) diff --git a/calculate/lib/utils/text.py b/calculate/lib/utils/text.py index 2387d92..af375b2 100644 --- a/calculate/lib/utils/text.py +++ b/calculate/lib/utils/text.py @@ -377,7 +377,7 @@ def formatListOr(lst): """Convert list to string like this: [1,2,3] -> 1,2 or 3""" lststr = map(lambda x:str(x),lst) return (" %s "%_("or")).join(filter(lambda x:x, - [",".join(map(lambda x:x or "''",lststr[:-1])), + [", ".join(map(lambda x:x or "''",lststr[:-1])), "".join(lststr[-1:])])) def getTerminalSize(): diff --git a/calculate/lib/variables/env.py b/calculate/lib/variables/env.py index 87d43cc..f35e3f7 100644 --- a/calculate/lib/variables/env.py +++ b/calculate/lib/variables/env.py @@ -364,10 +364,11 @@ class VariableClTemplatesLocate(Variable): metavalue = "TEMPLATES" untrusted = True - descriptionMap = {'overlay':_('Overlay templates'), - 'local':_('Local templates'), - 'remote':_('Remote templates'), - 'clt':_('clt templates')} + descriptionMap = {'overlay': _('Overlay templates'), + 'local': _('Local templates'), + 'distro': _('Distributive templates'), + 'remote': _('Remote templates'), + 'clt': _('clt templates')} def init(self): self.label = _("Templates location")