Skip to content

Commit b08b35c

Browse files
Accomodate reviewer's comments.
1 parent 965794c commit b08b35c

17 files changed

+33
-68
lines changed

appengine/mail/attachment.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
from google.appengine.api import app_identity
1516
from google.appengine.api import mail
1617
import webapp2
@@ -20,18 +21,19 @@
2021
class AttachmentHandler(webapp2.RequestHandler):
2122
def post(self):
2223
f = self.request.POST['file']
23-
mail.send_mail(sender=('%s@appspot.gserviceaccount.com' %
24-
app_identity.get_application_id()),
24+
mail.send_mail(sender='{}@appspot.gserviceaccount.com'.format(
25+
app_identity.get_application_id()),
2526
to="Albert Johnson <[email protected]>",
2627
subject="The doc you requested",
27-
body="""Attached is the document file you requested.
28+
body="""
29+
Attached is the document file you requested.
2830
2931
The example.com Team
3032
""",
3133
attachments=[(f.filename, f.file.read())])
3234
# [END send_attachment]
3335
self.response.content_type = 'text/plain'
34-
self.response.write('Sent %s to Albert.' % f.filename)
36+
self.response.write('Sent {} to Albert.'.format(f.filename))
3537

3638
def get(self):
3739
self.response.content_type = 'text/html'

appengine/mail/attachment_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import attachment
1516
import webtest
1617

appengine/mail/handle_bounced_email.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import logging
1516

1617
from google.appengine.ext.webapp.mail_handlers import BounceNotificationHandler

appengine/mail/handle_bounced_email_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
from google.appengine.ext.webapp.mail_handlers import BounceNotification
1516

1617
import handle_bounced_email

appengine/mail/handle_catchall.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

appengine/mail/handle_incoming_email_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
from google.appengine.api import mail
1516

1617
import handle_incoming_email

appengine/mail/handle_owner.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

appengine/mail/handle_support.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

appengine/mail/header.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ def get(self):
4242
def post(self):
4343
print repr(self.request.POST)
4444
id = self.request.POST['thread_id']
45-
send_example_mail('%s@appspot.gserviceaccount.com' %
46-
app_identity.get_application_id(), id)
45+
send_example_mail('{}@appspot.gserviceaccount.com'.format(
46+
app_identity.get_application_id()), id)
4747
self.response.content_type = 'text/plain'
4848
self.response.write(
49-
'Sent an email to Albert with Reference header set to %s.' % id)
49+
'Sent an email to Albert with Reference header set to {}.'
50+
.format(id))
5051

5152

5253
app = webapp2.WSGIApplication([

appengine/mail/header_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import header
1516
import webtest
1617

appengine/mail/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
<p><a href="attachment">Send email with attachments.</a></p>
2727
<p><a href="header">Send email with headers.</a></p>
2828
</body>
29-
</html>
29+
</html>

appengine/mail/send_mail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def send_approved_mail(sender_address):
3737

3838
class SendMailHandler(webapp2.RequestHandler):
3939
def get(self):
40-
send_approved_mail('%s@appspot.gserviceaccount.com' %
41-
app_identity.get_application_id())
40+
send_approved_mail('{}@appspot.gserviceaccount.com'.format(
41+
app_identity.get_application_id()))
4242
self.response.content_type = 'text/plain'
4343
self.response.write('Sent an email to Albert.')
4444

appengine/mail/send_mail_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import send_mail
1516
import webtest
1617

appengine/mail/send_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def send_approved_mail(sender_address):
4040

4141
class SendMessageHandler(webapp2.RequestHandler):
4242
def get(self):
43-
send_approved_mail('%s@appspot.gserviceaccount.com' %
44-
app_identity.get_application_id())
43+
send_approved_mail('{}@appspot.gserviceaccount.com'.format(
44+
app_identity.get_application_id()))
4545
self.response.content_type = 'text/plain'
4646
self.response.write('Sent an email message to Albert.')
4747

appengine/mail/send_message_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import send_message
1516
import webtest
1617

appengine/mail/user_signup.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ def post(self):
3535
else:
3636
confirmation_url = create_new_user_confirmation(user_address)
3737
sender_address = (
38-
'Example.com Support <%s@appspot.gserviceaccount.com>' %
39-
app_identity.get_application_id())
38+
'Example.com Support <{}@appspot.gserviceaccount.com>'.format(
39+
app_identity.get_application_id()))
4040
subject = 'Confirm your registration'
4141
body = """Thank you for creating an account!
4242
Please confirm your email address by clicking on the link below:
4343
44-
%s
45-
""" % confirmation_url
44+
{}
45+
""".format(confirmation_url)
4646
mail.send_mail(sender_address, user_address, subject, body)
4747
# [END send-confirm-email]
4848
self.response.content_type = 'text/plain'
49-
self.response.write('An email has been sent to %s.' % user_address)
49+
self.response.write('An email has been sent to {}.'.format(
50+
user_address))
5051

5152
def get(self):
5253
self.response.content_type = 'text/html'
@@ -76,7 +77,7 @@ def create_new_user_confirmation(user_address):
7677
record = UserConfirmationRecord(user_address=user_address,
7778
id=random_id)
7879
record.put()
79-
return 'https://%s/user/confirm?code=%s' % (
80+
return 'https://{}/user/confirm?code={}'.format(
8081
socket.getfqdn(socket.gethostname()), random_id)
8182

8283

@@ -93,7 +94,8 @@ def get(self):
9394
record.confirmed = True
9495
record.put()
9596
self.response.content_type = 'text/plain'
96-
self.response.write('Confirmed %s.' % record.user_address)
97+
self.response.write('Confirmed {}.'
98+
.format(record.user_address))
9799
return
98100
self.response.status_int = 404
99101

appengine/mail/user_signup_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import user_signup
1516
import webtest
1617

@@ -25,7 +26,7 @@ def test_user_signup(testbed):
2526
assert 'An email has been sent to [email protected].' in response.body
2627

2728
records = user_signup.UserConfirmationRecord.query().fetch(1)
28-
response = app.get('/user/confirm?code=%s' % records[0].key.id())
29+
response = app.get('/user/confirm?code={}'.format(records[0].key.id()))
2930
assert response.status_int == 200
3031
assert 'Confirmed [email protected].' in response.body
3132

0 commit comments

Comments
 (0)