(self, filename, filemode=0o600, dirmode=0o700, mask=0o755)
chmod file or directory
chmod file or directory
chmod file or directory
def _chmod(self, filename, filemode=0o600, dirmode=0o700, mask=0o755):
        """chmod file or directory"""
        try:
            filestat = os.lstat(filename).st_mode
            if stat.S_ISREG(filestat) and filemode:
                mode = (stat.S_IMODE(filestat) & mask) | filemode
                os.chmod(filename, mode)
            elif stat.S_ISDIR(filestat) and dirmode:
                mode = (stat.S_IMODE(filestat) & mask) | dirmode
                os.chmod(filename, mode)
            elif stat.S_ISLNK(filestat) and filemode:
                pass
            elif filemode:
                mode = (stat.S_IMODE(filestat) & mask) | filemode
                os.chmod(filename, mode)
        except OSError:
            Msg().err("Error: changing permissions of:", filename, l=Msg.VER)
            raise OSError
def _chmod ( self , filename , filemode = 0o600 , dirmode = 0o700 , mask = 0o755 ) : try : filestat = os . lstat ( filename ) . st_mode if stat . S_ISREG ( filestat ) and filemode : mode = ( stat . S_IMODE ( filestat ) & mask ) | filemode os . chmod ( filename , mode ) elif stat . S_ISDIR ( filestat ) and dirmode : mode = ( stat . S_IMODE ( filestat ) & mask ) | dirmode os . chmod ( filename , mode ) elif stat . S_ISLNK ( filestat ) and filemode : pass elif filemode : mode = ( stat . S_IMODE ( filestat ) & mask ) | filemode os . chmod ( filename , mode ) except OSError : Msg ( ) . err ( "Error: changing permissions of:" , filename , l = Msg . VER ) raise OSError