Show More
@@ -685,20 +685,22 b' def opener(base, audit=True):' | |||||
685 | d, fn = os.path.split(name) |
|
685 | d, fn = os.path.split(name) | |
686 | fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) |
|
686 | fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) | |
687 | os.close(fd) |
|
687 | os.close(fd) | |
688 | fp = posixfile(temp, "wb") |
|
688 | ofp = posixfile(temp, "wb") | |
689 | try: |
|
689 | try: | |
690 | try: |
|
690 | try: | |
691 |
|
|
691 | ifp = posixfile(name, "rb") | |
692 | except IOError, inst: |
|
692 | except IOError, inst: | |
693 | if not getattr(inst, 'filename', None): |
|
693 | if not getattr(inst, 'filename', None): | |
694 | inst.filename = name |
|
694 | inst.filename = name | |
695 | raise |
|
695 | raise | |
696 | fp.write(s) |
|
696 | for chunk in filechunkiter(ifp): | |
|
697 | ofp.write(chunk) | |||
|
698 | ifp.close() | |||
|
699 | ofp.close() | |||
697 | except: |
|
700 | except: | |
698 | try: os.unlink(temp) |
|
701 | try: os.unlink(temp) | |
699 | except: pass |
|
702 | except: pass | |
700 | raise |
|
703 | raise | |
701 | fp.close() |
|
|||
702 | st = os.lstat(name) |
|
704 | st = os.lstat(name) | |
703 | os.chmod(temp, st.st_mode) |
|
705 | os.chmod(temp, st.st_mode) | |
704 | return temp |
|
706 | return temp |
General Comments 0
You need to be logged in to leave comments.
Login now