mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Modernize use of range()
In Python 3, range() behaves like the old xrange(). The difference between range() and xrange() is usually not significant, especially if the whole result is iterated over. Convert xrange() usage to range() for small ranges. Use modern idioms in a few other uses of range(). Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
9e917cae39
commit
5178e9a597
@@ -1475,12 +1475,12 @@ class IA5Str(Str):
|
||||
|
||||
def _convert_scalar(self, value, index=None):
|
||||
if isinstance(value, six.string_types):
|
||||
for i in xrange(len(value)):
|
||||
if ord(value[i]) > 127:
|
||||
for char in value:
|
||||
if ord(char) > 127:
|
||||
raise ConversionError(name=self.get_param_name(),
|
||||
index=index,
|
||||
error=_('The character %(char)r is not allowed.') %
|
||||
dict(char=value[i],)
|
||||
dict(char=char,)
|
||||
)
|
||||
return super(IA5Str, self)._convert_scalar(value, index)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user