Change the messages that correspond to certain keys.
(self, arg=None)
| 162 | raise KeyError('No messages in mailbox') |
| 163 | |
| 164 | def update(self, arg=None): |
| 165 | """Change the messages that correspond to certain keys.""" |
| 166 | if hasattr(arg, 'iteritems'): |
| 167 | source = arg.iteritems() |
| 168 | elif hasattr(arg, 'items'): |
| 169 | source = arg.items() |
| 170 | else: |
| 171 | source = arg |
| 172 | bad_key = False |
| 173 | for key, message in source: |
| 174 | try: |
| 175 | self[key] = message |
| 176 | except KeyError: |
| 177 | bad_key = True |
| 178 | if bad_key: |
| 179 | raise KeyError('No message with key(s)') |
| 180 | |
| 181 | def flush(self): |
| 182 | """Write any pending changes to the disk.""" |