VirtualMailManager/VirtualMailManager.py
changeset 14 ebc9b864bc9a
parent 12 44161dbb1518
child 16 3388b96fd3ed
equal deleted inserted replaced
13:1d9bf63a86f7 14:ebc9b864bc9a
    58         if self.__chkCfgFile():
    58         if self.__chkCfgFile():
    59             self.__Cfg = Cfg(self.__cfgFileName)
    59             self.__Cfg = Cfg(self.__cfgFileName)
    60             self.__Cfg.load()
    60             self.__Cfg.load()
    61             self.__Cfg.check()
    61             self.__Cfg.check()
    62             self.__cfgSections = self.__Cfg.getsections()
    62             self.__cfgSections = self.__Cfg.getsections()
    63         self.__chkenv()
    63         if not sys.argv[1] in ['cf', 'configure']:
       
    64             self.__chkenv()
    64 
    65 
    65     def __chkCfgFile(self):
    66     def __chkCfgFile(self):
    66         """Checks the configuration file, returns bool"""
    67         """Checks the configuration file, returns bool"""
    67         if not os.path.isfile(self.__cfgFileName):
    68         if not os.path.isfile(self.__cfgFileName):
    68             raise VMMException(("The file »%s« does not exists." %
    69             raise VMMException(("The file »%s« does not exists." %
    87         elif not os.path.isdir(self.__Cfg.get('maildir', 'base')):
    88         elif not os.path.isdir(self.__Cfg.get('maildir', 'base')):
    88             raise VMMException(('%s is not a directory' %
    89             raise VMMException(('%s is not a directory' %
    89                 self.__Cfg.get('maildir', 'base'), ERR.NO_SUCH_DIRECTORY))
    90                 self.__Cfg.get('maildir', 'base'), ERR.NO_SUCH_DIRECTORY))
    90         for opt, val in self.__Cfg.items('bin'):
    91         for opt, val in self.__Cfg.items('bin'):
    91             if not os.path.exists(val):
    92             if not os.path.exists(val):
    92                 raise VMMException(("%s doesn't exists.", ERR.NO_SUCH_BINARY))
    93                 raise VMMException(("%s doesn't exists." % val,
       
    94                     ERR.NO_SUCH_BINARY))
    93             elif not os.access(val, os.X_OK):
    95             elif not os.access(val, os.X_OK):
    94                 raise VMMException(("%s is not executable.", ERR.NOT_EXECUTABLE))
    96                 raise VMMException(("%s is not executable." % val,
       
    97                     ERR.NOT_EXECUTABLE))
    95 
    98 
    96     def __getFileMode(self):
    99     def __getFileMode(self):
    97         """Determines the file access mode from file __cfgFileName,
   100         """Determines the file access mode from file __cfgFileName,
    98         returns int.
   101         returns int.
    99         """
   102         """