Mercurial > p > roundup > code
diff 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 |
line wrap: on
line diff
--- a/scripts/imapServer.py Tue Jul 24 21:43:32 2018 +0000 +++ b/scripts/imapServer.py Tue Jul 24 22:08:17 2018 +0000 @@ -137,19 +137,19 @@ each mailbox is associated with 1 database home """ log.info('Adding mailbox %s', mailbox) - if not self.mailboxes.has_key(mailbox.server): + if mailbox.server not in self.mailboxes: self.mailboxes[mailbox.server] = {'protocol':'imaps', 'users':{}} server = self.mailboxes[mailbox.server] if mailbox.protocol: server['protocol'] = mailbox.protocol - if not server['users'].has_key(mailbox.username): + if mailbox.username not in server['users']: server['users'][mailbox.username] = {'password':'', 'mailboxes':{}} user = server['users'][mailbox.username] if mailbox.password: user['password'] = mailbox.password - if user['mailboxes'].has_key(mailbox.mailbox): + if mailbox.mailbox in user['mailboxes']: raise ValueError('Mailbox is already defined') user['mailboxes'][mailbox.mailbox] = mailbox.dbhome
