Fix print messages from stderr. Fix delete template vars. Fix server.ldap module (Can't import module 'ldap').

develop
Самоукин Алексей 14 years ago
parent 133ba00dad
commit e52d9ec12a

@ -413,14 +413,19 @@ storage of variables templates")%location)
if not header:
header = self.__getSection(vname)
# Удаляем переменную
retDelVar = config.delVar(header, vname)
retDelArea = True
if not config.getAreaVars(header):
retDelArea = config.delArea(header)
if retDelArea and retDelVar:
return True
else:
allVars = config.getAreaVars(header)
if allVars is False:
return False
if vname in allVars.keys():
retDelVar = config.delVar(header, vname)
retDelArea = True
if not config.getAreaVars(header):
retDelArea = config.delArea(header)
if retDelArea and retDelVar:
return True
else:
return False
return True
def Write(self,vname,val=None,force=False,location='default',header=False):
'''Установить и записать значение переменной в ini файл

@ -24,7 +24,7 @@ class color_print(object):
def getconsolewidth(self):
"""Получить ширину текущей консоли"""
s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
fd_stdout = self._printSysOut.fileno()
try:
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
except IOError:
@ -40,7 +40,7 @@ class color_print(object):
"""
cols = self.getconsolewidth()
for i in range(cols - offsetLeft - offsetRight):
sys.stdout.write(" ")
self._printSysOut.write(" ")
def colorPrint(self,attr,fg,bg,string):
"""Раскрашивает выводимое сообщение

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import ldap as mod_ldap

@ -15,8 +15,12 @@
# limitations under the License.
import os
import ldap
from ldap import LDAPError, MOD_REPLACE, MOD_ADD, SCOPE_SUBTREE, SCOPE_ONELEVEL
from mod import mod_ldap
import sys
sys.modules['mod_ldap'] = mod_ldap
from mod_ldap import LDAPError, MOD_REPLACE, MOD_ADD, SCOPE_SUBTREE,\
SCOPE_ONELEVEL
from ldif import LDIFParser, LDIFWriter
import cStringIO, StringIO
from cl_utils import _error

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import sys, os
from cl_print import color_print
from cl_datavars import DataVars
@ -44,12 +44,13 @@ class services(color_print):
def allServicesApi(self):
self.createClLibVars(clLibVars=self.clLibVars)
apiDict = self.clLibVars.Get('cl_api')
if not apiDict or not type(apiDict) in dict:
if not apiDict or not type(apiDict) is dict:
return []
apiFiles = apiDict.keys()
apiFiles = apiDict.values()
apiObjects = []
for apiFile in apiFiles:
importPath, moduleName = os.path.split(apiFile)
moduleName = moduleName.rpartition(".py")[0]
if not importPath in sys.path:
sys.path.insert(0, importPath)
try:
@ -71,9 +72,9 @@ class services(color_print):
def runMethodToAllServices(self, methodName, sortedServices="normal"):
"""Stopped all setup services"""
allServObjs = self.allServicesApi()
allSetupServObjs = filter(lambda x: x.isSetup(), allServObjs)
if allServObjs is False:
return False
allSetupServObjs = filter(lambda x: x.isSetup(), allServObjs)
def smpPrioritetReverse(objectA, objectB):
'''Comparison of the run priorities of objects

@ -108,7 +108,7 @@ def rawInput(promptText="", inputText=""):
readline.set_pre_input_hook(None)
return strInput
def execProg(self, cmdStrProg, inStr=False, envProg={}):
def execProg(cmdStrProg, inStr=False, envProg={}):
"""Выполняет внешнюю программу
Параметры:

@ -68,7 +68,8 @@ setup(
'calculate-lib.pym.format',
'calculate-lib.pym.server',
'calculate-lib.pym.client',
'calculate-lib.pym.update_config'],
'calculate-lib.pym.update_config',
'calculate-lib.pym.mod'],
data_files = [("/usr/share/calculate/i18n",['i18n/cl_lib_ru.mo']),
("/var/calculate/remote", []),
("/var/log/calculate", [])],

Loading…
Cancel
Save