В cl_base добавлен метод exit()

Добавлено использование метода exit() в cl_fill и cl_base

git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@1019 c91db197-33c1-4113-bf15-f8a5c547ca64
develop
asamoukin 15 years ago
parent 494da77a73
commit 0bb7209e92

@ -32,11 +32,13 @@ import socket
import random
import string
import cl_utils
import imp
##############################################################################
_expand_lang = gettext._expand_lang
def exit(codeExit):
"""Метод выхода из программы"""
sys.exit(codeExit)
def __findFileMO(domain, localedir=None, languages=None, all=0):
# Модифицинрованный метод модуля gettext ищет файл перевода

@ -28,7 +28,7 @@ class fillVars(object, cl_base.glob_attr):
if not domain:
print _("Error:") + " " +_("Not found domain name")
print _("Command 'hostname -d' returns an empty value")
exit(1)
cl_base.exit(1)
elif re.search("^hostname: ",domain):
return "local"
else:

@ -171,7 +171,7 @@ class _terms(_error):
except self.objVar.DataVarsError, e:
print textError
print e
exit(1)
cl_base.exit(1)
# Cравниваем номера версий
if "_ver" in vals[0] or \
(flagFunction and "pkg" == searchFunct.group(1)) or\
@ -2162,7 +2162,7 @@ class profile(_file, _terms,xmlShare):
except self.objVar.DataVarsError, e:
print _("error in profile %s")%nameProfile
print e
exit(1)
cl_base.exit(1)
textProfileTmp = textProfileTmp.replace(mark, varValue)
resS = self._reVar.search(textProfileTmp)
return textProfileTmp
@ -2195,19 +2195,19 @@ class profile(_file, _terms,xmlShare):
except:
print _("error in profile %s")%nameProfile
print _("error var %s not int")%str(strNum)
exit(1)
cl_base.exit(1)
else:
print _("error in profile %s")%nameProfile
print _("error local var %s not defined")\
%str(strNum)
exit(1)
cl_base.exit(1)
if minus:
num =-num
strNumers.append(num)
return sum(strNumers)
print _("error in profile %s")%nameProfile
print _("error profile term %s, incorrect data")%str(term)
exit(1)
cl_base.exit(1)
def multAndDiv(term,sNum,sMD,localVars):
"""локальная функция для умножения и деления"""
@ -2255,7 +2255,7 @@ class profile(_file, _terms,xmlShare):
else:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
exit(1)
cl_base.exit(1)
return textProfileTmp
def funcLoad(funTxt,resS,textProfileTmp):
@ -2269,14 +2269,14 @@ class profile(_file, _terms,xmlShare):
len(terms)>2:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
exit(1)
cl_base.exit(1)
if len(terms) == 2:
if not terms[0] in ["ver","num","char","key"]:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
print _("first argument function is not 'ver' or 'num' or\
'char'")
exit(1)
cl_base.exit(1)
if len(terms) == 1:
fileName = terms[0].strip()
if fileName[0] != "/":
@ -2369,20 +2369,20 @@ class profile(_file, _terms,xmlShare):
len(terms)!=2:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
exit(1)
cl_base.exit(1)
fArgvNames = ['num','pas']
if not terms[0] in fArgvNames:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
print _("first argument function is not 'num' or 'pas'")
exit(1)
cl_base.exit(1)
try:
lenStr = int(terms[1])
except:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
print _("two argument function is not number")
exit(1)
cl_base.exit(1)
if terms[0] == fArgvNames[0]:
replace=''.join([random.choice(string.digits)\
for i in xrange(lenStr)])
@ -2392,7 +2392,7 @@ class profile(_file, _terms,xmlShare):
else:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
exit(1)
cl_base.exit(1)
textProfileTmp = textProfileTmp[:resS.start()] + replace +\
textProfileTmp[resS.end():]
return textProfileTmp
@ -2412,20 +2412,20 @@ class profile(_file, _terms,xmlShare):
(len(terms)==2 and not terms[1].strip()) or len(terms)!=2:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
exit(1)
cl_base.exit(1)
fArgvNames = ['upper','lower','capitalize']
if not terms[0] in fArgvNames:
print _("error in profile %s")%nameProfile
print _("error profile term %s")%str(funTxt)
print _("first argument function is not 'upper' or 'lower' or\
'capitalize'")
exit(1)
cl_base.exit(1)
try:
strValue = str(self.objVar.Get(terms[1]))
except:
print _("error in profile %s")%nameProfile
print _("error var %s not found")%str(terms[1])
exit(1)
cl_base.exit(1)
replace = ""
strValue = self._toUNICODE(strValue)
if terms[0] == 'upper':

Loading…
Cancel
Save