Skip to content

Commit

Permalink
flake8: rename loop variable in 'for sendto in sendto:'
Browse files Browse the repository at this point in the history
Flake8 reported 'B020 Found for loop that reassigns the iterable it is
iterating with each iterable value.'

Renamed loop variable to to_addr. There is a similar construct with a
loop over bcc_sendto with a 'bcc' loop variable. So I assume the loop
varaible can be chnaged w/o issue.

Codecov shows all the affected lines are being tested and the tests I
ran with testmon that should cover that code all passed.

We shall see if a full CI run passes.
  • Loading branch information
rouilj committed Jul 24, 2023
1 parent 401e179 commit 6d30932
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Fixed:
- issue2551283 - fail if version 2.4.9 of markdown2 is used, it broke
[issue1](issue1) style links. Support markdown2 2.4.8 and earlier
and 2.4.10 with its new schema filtering method. (John Rouillard)
- multiple flake8 fixes (John Rouillard)
- rename loop variable in 'for sendto in sendto:' (John Rouillard)

Features:

Expand Down
10 changes: 5 additions & 5 deletions roundup/roundupdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def send_message(self, issueid, msgid, note, sendto, from_address=None,
# can't fiddle the recipients in the message ... worth testing
# and/or fixing some day
first = True
for sendto in sendto:
for to_addr in sendto:
# create the message
mailer = Mailer(self.db.config)

Expand Down Expand Up @@ -721,18 +721,18 @@ def send_message(self, issueid, msgid, note, sendto, from_address=None,
message.set_payload(body, message.get_charset())

if crypt:
send_msg = self.encrypt_to(message, sendto)
send_msg = self.encrypt_to(message, to_addr)
else:
send_msg = message
mailer.set_message_attributes(send_msg, sendto, subject, author)
mailer.set_message_attributes(send_msg, to_addr, subject, author)
if crypt:
send_msg['Message-Id'] = message['Message-Id']
send_msg['Reply-To'] = message['Reply-To']
if message.get('In-Reply-To'):
send_msg['In-Reply-To'] = message['In-Reply-To']

if sendto:
mailer.smtp_send(sendto, send_msg.as_string())
if to_addr:
mailer.smtp_send(to_addr, send_msg.as_string())
if first:
if crypt:
# send individual bcc mails, otherwise receivers can
Expand Down

0 comments on commit 6d30932

Please sign in to comment.