Mercurial > p > roundup > code
comparison scripts/imapServer.py @ 5381:0942fe89e82e
Python 3 preparation: change "x.has_key(y)" to "y in x".
(Also likewise "not in" where appropriate.) Tool-generated patch.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 22:08:17 +0000 |
| parents | 35ea9b1efc14 |
| children | 4cf48ff01e04 |
comparison
equal
deleted
inserted
replaced
| 5380:64c4e43fbb84 | 5381:0942fe89e82e |
|---|---|
| 135 So there can be multiple servers, each with multiple users. | 135 So there can be multiple servers, each with multiple users. |
| 136 Each username can be associated with multiple mailboxes. | 136 Each username can be associated with multiple mailboxes. |
| 137 each mailbox is associated with 1 database home | 137 each mailbox is associated with 1 database home |
| 138 """ | 138 """ |
| 139 log.info('Adding mailbox %s', mailbox) | 139 log.info('Adding mailbox %s', mailbox) |
| 140 if not self.mailboxes.has_key(mailbox.server): | 140 if mailbox.server not in self.mailboxes: |
| 141 self.mailboxes[mailbox.server] = {'protocol':'imaps', 'users':{}} | 141 self.mailboxes[mailbox.server] = {'protocol':'imaps', 'users':{}} |
| 142 server = self.mailboxes[mailbox.server] | 142 server = self.mailboxes[mailbox.server] |
| 143 if mailbox.protocol: | 143 if mailbox.protocol: |
| 144 server['protocol'] = mailbox.protocol | 144 server['protocol'] = mailbox.protocol |
| 145 | 145 |
| 146 if not server['users'].has_key(mailbox.username): | 146 if mailbox.username not in server['users']: |
| 147 server['users'][mailbox.username] = {'password':'', 'mailboxes':{}} | 147 server['users'][mailbox.username] = {'password':'', 'mailboxes':{}} |
| 148 user = server['users'][mailbox.username] | 148 user = server['users'][mailbox.username] |
| 149 if mailbox.password: | 149 if mailbox.password: |
| 150 user['password'] = mailbox.password | 150 user['password'] = mailbox.password |
| 151 | 151 |
| 152 if user['mailboxes'].has_key(mailbox.mailbox): | 152 if mailbox.mailbox in user['mailboxes']: |
| 153 raise ValueError('Mailbox is already defined') | 153 raise ValueError('Mailbox is already defined') |
| 154 | 154 |
| 155 user['mailboxes'][mailbox.mailbox] = mailbox.dbhome | 155 user['mailboxes'][mailbox.mailbox] = mailbox.dbhome |
| 156 | 156 |
| 157 def _process(self, message, dbhome): | 157 def _process(self, message, dbhome): |
