Package logilab :: Package common :: Module fileutils :: Class ProtectedFile
[frames] | no frames]

Class ProtectedFile

source code

compat.FileIO --+
                |
               ProtectedFile

A special file-object class that automatically does a 'chmod +w' when needed.

XXX: for now, the way it is done allows 'normal file-objects' to be created during the ProtectedFile object lifetime. One way to circumvent this would be to chmod / unchmod on each write operation.

One other way would be to :

Instance Methods
 
__init__(self, filepath, mode) source code
 
close(self)
restore mode before closing
source code
 
__del__(self) source code