diff options
author | Guido van Rossum <guido@python.org> | 1994-09-09 11:10:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-09-09 11:10:15 (GMT) |
commit | 853474194fa799ab96a135f900332eaca52a07e7 (patch) | |
tree | 85f3129f76bd427327cc8a55d00e8561b5631a49 /Lib/mhlib.py | |
parent | 91951481b8b7bf134ed5c662373164d205ab8046 (diff) | |
download | cpython-853474194fa799ab96a135f900332eaca52a07e7.zip cpython-853474194fa799ab96a135f900332eaca52a07e7.tar.gz cpython-853474194fa799ab96a135f900332eaca52a07e7.tar.bz2 |
mhlib.py: delay opening of sequences file so we don't overwrite it when
putsequences is called with a bad argument
rfc822.py: better handling of dates with no or bad timezones
uu.py: contributed by Lance -- uu{en,de}code
Diffstat (limited to 'Lib/mhlib.py')
-rw-r--r-- | Lib/mhlib.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/mhlib.py b/Lib/mhlib.py index b24695c..5bdda72 100644 --- a/Lib/mhlib.py +++ b/Lib/mhlib.py @@ -36,6 +36,7 @@ # f.putsequences(dict) # write sequences back to folder # # m = f.openmessage(n) # new open message object (costs a file descriptor) +# m is a derived class of mimetools.Message(rfc822.Message), with: # s = m.getheadertext() # text of message's headers # s = m.getheadertext(pred) # text of message's headers, filtered by pred # s = m.getbodytext() # text of message's body, decoded @@ -299,11 +300,19 @@ class Folder: # Write the set of sequences back to the folder def putsequences(self, sequences): fullname = self.getsequencesfilename() - f = open(fullname, 'w') + f = None for key in sequences.keys(): s = IntSet('', ' ') s.fromlist(sequences[key]) + if not f: f = open(fullname, 'w') f.write('%s: %s\n' % (key, s.tostring())) + if not f: + try: + os.unlink(fullname) + except os.error: + pass + else: + f.close() # Return the current message. Raise KeyError when there is none def getcurrent(self): @@ -313,7 +322,7 @@ class Folder: def setcurrent(self, n): updateline(self.getsequencesfilename(), 'cur', str(n), 0) - # Open a message -- returns a mimetools.Message object + # Open a message -- returns a Message object def openmessage(self, n): path = self.getmessagefilename(n) return Message(self, n) |