Fixed #28226 -- Replaced use of str.join() with concatenation.

This commit is contained in:
Tom 2017-05-20 22:16:36 +01:00 committed by Tim Graham
parent 94475aab80
commit 7afb476469
10 changed files with 22 additions and 19 deletions

View File

@ -560,7 +560,7 @@ class ModelAdminChecks(BaseModelAdminChecks):
def _check_inlines_item(self, obj, model, inline, label):
""" Check one inline model admin. """
inline_label = '.'.join([inline.__module__, inline.__name__])
inline_label = inline.__module__ + '.' + inline.__name__
from django.contrib.admin.options import InlineModelAdmin

View File

@ -26,7 +26,7 @@ class BaseUserManager(models.Manager):
except ValueError:
pass
else:
email = '@'.join([email_name, domain_part.lower()])
email = email_name + '@' + domain_part.lower()
return email
def make_random_password(self, length=10,

View File

@ -13,10 +13,10 @@ class BaseGenericInlineFormSet(BaseModelFormSet):
prefix=None, queryset=None, **kwargs):
opts = self.model._meta
self.instance = instance
self.rel_name = '-'.join((
opts.app_label, opts.model_name,
self.ct_field.name, self.ct_fk_field.name,
))
self.rel_name = (
opts.app_label + '-' + opts.model_name + '-' +
self.ct_field.name + '-' + self.ct_fk_field.name
)
if self.instance is None or self.instance.pk is None:
qs = self.model._default_manager.none()
else:
@ -32,7 +32,10 @@ class BaseGenericInlineFormSet(BaseModelFormSet):
@classmethod
def get_default_prefix(cls):
opts = cls.model._meta
return '-'.join((opts.app_label, opts.model_name, cls.ct_field.name, cls.ct_fk_field.name))
return (
opts.app_label + '-' + opts.model_name + '-' +
cls.ct_field.name + '-' + cls.ct_fk_field.name
)
def save_new(self, form, commit=True):
setattr(form.instance, self.ct_field.get_attname(), ContentType.objects.get_for_model(self.instance).pk)

View File

@ -1282,8 +1282,8 @@ class Prefetch:
return obj_dict
def add_prefix(self, prefix):
self.prefetch_through = LOOKUP_SEP.join([prefix, self.prefetch_through])
self.prefetch_to = LOOKUP_SEP.join([prefix, self.prefetch_to])
self.prefetch_through = prefix + LOOKUP_SEP + self.prefetch_through
self.prefetch_to = prefix + LOOKUP_SEP + self.prefetch_to
def get_current_prefetch_to(self, level):
return LOOKUP_SEP.join(self.prefetch_to.split(LOOKUP_SEP)[:level + 1])

View File

@ -399,17 +399,17 @@ class BaseFormSet:
# probably should be. It might make sense to render each form as a
# table row with each field as a td.
forms = ' '.join(form.as_table() for form in self)
return mark_safe('\n'.join([str(self.management_form), forms]))
return mark_safe(str(self.management_form) + '\n' + forms)
def as_p(self):
"Return this formset rendered as HTML <p>s."
forms = ' '.join(form.as_p() for form in self)
return mark_safe('\n'.join([str(self.management_form), forms]))
return mark_safe(str(self.management_form) + '\n' + forms)
def as_ul(self):
"Return this formset rendered as HTML <li>s."
forms = ' '.join(form.as_ul() for form in self)
return mark_safe('\n'.join([str(self.management_form), forms]))
return mark_safe(str(self.management_form) + '\n' + forms)
def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,

View File

@ -401,7 +401,7 @@ class LazyStream:
return
self._update_unget_history(len(bytes))
self.position -= len(bytes)
self._leftover = b''.join([bytes, self._leftover])
self._leftover = bytes + self._leftover
def _update_unget_history(self, num_bytes):
"""

View File

@ -92,7 +92,7 @@ class HttpResponseBase:
return val if isinstance(val, bytes) else val.encode(encoding)
headers = [
(b': '.join([to_bytes(key, 'ascii'), to_bytes(value, 'latin-1')]))
(to_bytes(key, 'ascii') + b': ' + to_bytes(value, 'latin-1'))
for key, value in self._headers.values()
]
return b'\r\n'.join(headers)

View File

@ -41,10 +41,10 @@ class ResolverMatch:
if not hasattr(func, '__name__'):
# A class-based view
self._func_path = '.'.join([func.__class__.__module__, func.__class__.__name__])
self._func_path = func.__class__.__module__ + '.' + func.__class__.__name__
else:
# A function-based view
self._func_path = '.'.join([func.__module__, func.__name__])
self._func_path = func.__module__ + '.' + func.__name__
view_path = url_name or self._func_path
self.view_name = ':'.join(self.namespaces + [view_path])

View File

@ -600,8 +600,8 @@ def _date_from_string(year, year_format, month='', month_format='', day='', day_
Get a datetime.date object given a format string and a year, month, and day
(only year is mandatory). Raise a 404 for an invalid date.
"""
format = delim.join((year_format, month_format, day_format))
datestr = delim.join((year, month, day))
format = year_format + delim + month_format + delim + day_format
datestr = year + delim + month + delim + day
try:
return datetime.datetime.strptime(datestr, format).date()
except ValueError:

View File

@ -183,7 +183,7 @@ def setup(verbosity, test_labels, parallel):
installed_app_names = set(get_installed())
for modpath, module_name in test_modules:
if modpath:
module_label = '.'.join([modpath, module_name])
module_label = modpath + '.' + module_name
else:
module_label = module_name
# if the module (or an ancestor) was named on the command line, or