mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
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['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.
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user