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