Show More
@@ -1005,7 +1005,7 b' def opener(base, audit=True):' | |||
|
1005 | 1005 | p = base |
|
1006 | 1006 | audit_p = audit |
|
1007 | 1007 | |
|
1008 | def mktempcopy(name): | |
|
1008 | def mktempcopy(name, emptyok=False): | |
|
1009 | 1009 | d, fn = os.path.split(name) |
|
1010 | 1010 | fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) |
|
1011 | 1011 | os.close(fd) |
@@ -1019,6 +1019,8 b' def opener(base, audit=True):' | |||
|
1019 | 1019 | raise |
|
1020 | 1020 | st_mode = 0666 & ~_umask |
|
1021 | 1021 | os.chmod(temp, st_mode) |
|
1022 | if emptyok: | |
|
1023 | return temp | |
|
1022 | 1024 | try: |
|
1023 | 1025 | try: |
|
1024 | 1026 | ifp = posixfile(name, "rb") |
@@ -1043,7 +1045,7 b' def opener(base, audit=True):' | |||
|
1043 | 1045 | """the file will only be copied when rename is called""" |
|
1044 | 1046 | def __init__(self, name, mode): |
|
1045 | 1047 | self.__name = name |
|
1046 | self.temp = mktempcopy(name) | |
|
1048 | self.temp = mktempcopy(name, emptyok=('w' in mode)) | |
|
1047 | 1049 | posixfile.__init__(self, self.temp, mode) |
|
1048 | 1050 | def rename(self): |
|
1049 | 1051 | if not self.closed: |
General Comments 0
You need to be logged in to leave comments.
Login now