mirror of https://github.com/django/django.git
Replaced some map() and filter() calls with generators.
This commit is contained in:
parent
37ab3c3f9d
commit
94475aab80
|
@ -256,9 +256,9 @@ class EmailMessage:
|
||||||
msg['From'] = self.extra_headers.get('From', self.from_email)
|
msg['From'] = self.extra_headers.get('From', self.from_email)
|
||||||
msg['To'] = self.extra_headers.get('To', ', '.join(map(str, self.to)))
|
msg['To'] = self.extra_headers.get('To', ', '.join(map(str, self.to)))
|
||||||
if self.cc:
|
if self.cc:
|
||||||
msg['Cc'] = ', '.join(map(str, self.cc))
|
msg['Cc'] = ', '.join(str(cc) for cc in self.cc)
|
||||||
if self.reply_to:
|
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
|
# Email header names are case-insensitive (RFC 2045), so we have to
|
||||||
# accommodate that when doing comparisons.
|
# accommodate that when doing comparisons.
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Loader(BaseLoader):
|
||||||
if matching:
|
if matching:
|
||||||
skip_prefix = self.generate_hash(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):
|
def generate_hash(self, values):
|
||||||
return hashlib.sha1(force_bytes('|'.join(values))).hexdigest()
|
return hashlib.sha1(force_bytes('|'.join(values))).hexdigest()
|
||||||
|
|
Loading…
Reference in New Issue