You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-3-unix/pym/cl_ldap_service.py

54 lines
2.0 KiB

#-*- coding: utf-8 -*-
# Copyright 2008-2010 Mir Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from cl_ldap_api import allMethods, __app__
from cl_utils import appendProgramToEnvFile, removeProgramToEnvFile
import sys
from cl_lang import lang
lang().setLanguage(sys.modules[__name__])
class ldapService(allMethods):
def installProg(self):
'''Install this program'''
apiDict = self.clVars.Get("cl_api")
apiDict.update({__app__:self.apiFile})
self.clVars.Write("cl_api", force=True)
if not appendProgramToEnvFile(__app__, self.clVars):
self.printERROR(_("Can not save '%s'") %__app__ + " " +\
_("to %s") %self.clVars.Get("cl_env_path")[0])
return False
self.printOK(_("Save install variables"))
return True
def uninstallProg(self):
'''Uninstall this program'''
apiDict = self.clVars.Get("cl_api")
if __app__ in apiDict:
apiDict.pop(__app__)
self.clVars.Write("cl_api", force=True)
if not removeProgramToEnvFile(__app__, self.clVars):
self.printERROR(_("Can not remove '%s' to %s")%(__app__,
self.clVars.Get("cl_env_path")[0]))
return False
self.printOK(_("Delete install variables"))
return True
def printVars(self, *arg, **argv):
"""Печать существующих переменных"""
self.clVars.printVars(*arg, **argv)