From 94475aab800fc492853b67ada6b6b33d47554393 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 20 May 2017 22:33:51 +0100 Subject: [PATCH] Replaced some map() and filter() calls with generators. --- django/core/mail/message.py | 4 ++-- django/template/loaders/cached.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/django/core/mail/message.py b/django/core/mail/message.py index 20432b05af..eb10ff1b73 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -256,9 +256,9 @@ class EmailMessage: msg['From'] = self.extra_headers.get('From', self.from_email) msg['To'] = self.extra_headers.get('To', ', '.join(map(str, self.to))) if self.cc: - msg['Cc'] = ', '.join(map(str, self.cc)) + msg['Cc'] = ', '.join(str(cc) for cc in self.cc) if self.reply_to: - msg['Reply-To'] = self.extra_headers.get('Reply-To', ', '.join(map(str, self.reply_to))) + msg['Reply-To'] = self.extra_headers.get('Reply-To', ', '.join(str(r) for r in self.reply_to)) # Email header names are case-insensitive (RFC 2045), so we have to # accommodate that when doing comparisons. diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py index 20abe21b35..b0799a2d0e 100644 --- a/django/template/loaders/cached.py +++ b/django/template/loaders/cached.py @@ -85,7 +85,7 @@ class Loader(BaseLoader): if matching: skip_prefix = self.generate_hash(matching) - return '-'.join(filter(bool, [str(template_name), skip_prefix, dirs_prefix])) + return '-'.join(s for s in (str(template_name), skip_prefix, dirs_prefix) if s) def generate_hash(self, values): return hashlib.sha1(force_bytes('|'.join(values))).hexdigest()