comparison roundup/mailgw.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 d26921b851c3
comparison
equal deleted inserted replaced
5380:64c4e43fbb84 5381:0942fe89e82e
1004 title += ' ' + argswhole 1004 title += ' ' + argswhole
1005 1005
1006 1006
1007 # set the issue title to the subject 1007 # set the issue title to the subject
1008 title = title.strip() 1008 title = title.strip()
1009 if (title and self.properties.has_key('title') and not 1009 if (title and 'title' in self.properties and 'title' not in issue_props):
1010 issue_props.has_key('title')):
1011 issue_props['title'] = title 1010 issue_props['title'] = title
1012 if (self.nodeid and self.properties.has_key('title') and not 1011 if (self.nodeid and 'title' in self.properties and not
1013 self.config['MAILGW_SUBJECT_UPDATES_TITLE']): 1012 self.config['MAILGW_SUBJECT_UPDATES_TITLE']):
1014 issue_props['title'] = self.cl.get(self.nodeid,'title') 1013 issue_props['title'] = self.cl.get(self.nodeid,'title')
1015 1014
1016 # merge the command line props defined in issue_props into 1015 # merge the command line props defined in issue_props into
1017 # the props dictionary because function(**props, **issue_props) 1016 # the props dictionary because function(**props, **issue_props)
1018 # is a syntax error. 1017 # is a syntax error.
1019 for prop in issue_props.keys() : 1018 for prop in issue_props.keys() :
1020 if not props.has_key(prop) : 1019 if prop not in props :
1021 props[prop] = issue_props[prop] 1020 props[prop] = issue_props[prop]
1022 1021
1023 self.props = props 1022 self.props = props
1024 1023
1025 def get_pgp_message(self): 1024 def get_pgp_message(self):
1103 1102
1104 1103
1105 def create_files(self): 1104 def create_files(self):
1106 ''' Create a file for each attachment in the message 1105 ''' Create a file for each attachment in the message
1107 ''' 1106 '''
1108 if not self.properties.has_key('files'): 1107 if 'files' not in self.properties:
1109 return 1108 return
1110 files = [] 1109 files = []
1111 file_props = self.mailgw.get_class_arguments('file') 1110 file_props = self.mailgw.get_class_arguments('file')
1112 1111
1113 if self.attachments: 1112 if self.attachments:
1142 self.props['files'] = files 1141 self.props['files'] = files
1143 1142
1144 def create_msg(self): 1143 def create_msg(self):
1145 ''' Create msg containing all the relevant information from the message 1144 ''' Create msg containing all the relevant information from the message
1146 ''' 1145 '''
1147 if not self.properties.has_key('messages'): 1146 if 'messages' not in self.properties:
1148 return 1147 return
1149 msg_props = self.mailgw.get_class_arguments('msg') 1148 msg_props = self.mailgw.get_class_arguments('msg')
1150 self.msg_props.update (msg_props) 1149 self.msg_props.update (msg_props)
1151 1150
1152 # Get the message ids 1151 # Get the message ids
1766 if user is not None: 1765 if user is not None:
1767 return user 1766 return user
1768 1767
1769 # try the user alternate addresses if possible 1768 # try the user alternate addresses if possible
1770 props = db.user.getprops() 1769 props = db.user.getprops()
1771 if props.has_key('alternate_addresses'): 1770 if 'alternate_addresses' in props:
1772 users = db.user.filter(None, {'alternate_addresses': address}) 1771 users = db.user.filter(None, {'alternate_addresses': address})
1773 # We want an exact match of the email, not just a substring 1772 # We want an exact match of the email, not just a substring
1774 # match. Otherwise e.g. support@example.com would match 1773 # match. Otherwise e.g. support@example.com would match
1775 # discuss-support@example.com which is not what we want. 1774 # discuss-support@example.com which is not what we want.
1776 found_users = [] 1775 found_users = []

Roundup Issue Tracker: http://roundup-tracker.org/