Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to using explicit new-style division behavior, rather than rel…

…ying on teh classic behavior.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16745 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 699688dc2cfad627c5d400c6bdb681c81e932bc0 1 parent e216c3c
@alex alex authored
View
12 django/contrib/humanize/templatetags/humanize.py
@@ -165,13 +165,13 @@ def naturaltime(value):
return ungettext(
u'a second ago', u'%(count)s seconds ago', delta.seconds
) % {'count': delta.seconds}
- elif delta.seconds / 60 < 60:
- count = delta.seconds / 60
+ elif delta.seconds // 60 < 60:
+ count = delta.seconds // 60
return ungettext(
u'a minute ago', u'%(count)s minutes ago', count
) % {'count': count}
else:
- count = delta.seconds / 60 / 60
+ count = delta.seconds // 60 // 60
return ungettext(
u'an hour ago', u'%(count)s hours ago', count
) % {'count': count}
@@ -187,13 +187,13 @@ def naturaltime(value):
return ungettext(
u'a second from now', u'%(count)s seconds from now', delta.seconds
) % {'count': delta.seconds}
- elif delta.seconds / 60 < 60:
- count = delta.seconds / 60
+ elif delta.seconds // 60 < 60:
+ count = delta.seconds // 60
return ungettext(
u'a minute from now', u'%(count)s minutes from now', count
) % {'count': count}
else:
- count = delta.seconds / 60 / 60
+ count = delta.seconds // 60 // 60
return ungettext(
u'an hour from now', u'%(count)s hours from now', count
) % {'count': count}
View
2  django/contrib/localflavor/se/utils.py
@@ -18,7 +18,7 @@ def id_number_checksum(gd):
if (s % 10) == 0:
return 0
- return (((s / 10) + 1) * 10) - s
+ return (((s // 10) + 1) * 10) - s
def validate_id_birthday(gd, fix_coordination_number_day=True):
"""
View
2  django/utils/baseconv.py
@@ -88,7 +88,7 @@ def convert(self, number, from_digits, to_digits, sign):
while x > 0:
digit = x % len(to_digits)
res = to_digits[digit] + res
- x = int(x / len(to_digits))
+ x = int(x // len(to_digits))
return neg, res
base2 = BaseConverter(BASE2_ALPHABET)
View
4 django/utils/feedgenerator.py
@@ -42,7 +42,7 @@ def rfc2822_date(date):
time_str = date.strftime('%s, %%d %s %%Y %%H:%%M:%%S ' % (dow, month))
if date.tzinfo:
offset = date.tzinfo.utcoffset(date)
- timezone = (offset.days * 24 * 60) + (offset.seconds / 60)
+ timezone = (offset.days * 24 * 60) + (offset.seconds // 60)
hour, minute = divmod(timezone, 60)
return time_str + "%+03d%02d" % (hour, minute)
else:
@@ -54,7 +54,7 @@ def rfc3339_date(date):
if date.tzinfo:
time_str = date.strftime('%Y-%m-%dT%H:%M:%S')
offset = date.tzinfo.utcoffset(date)
- timezone = (offset.days * 24 * 60) + (offset.seconds / 60)
+ timezone = (offset.days * 24 * 60) + (offset.seconds // 60)
hour, minute = divmod(timezone, 60)
return time_str + "%+03d:%02d" % (hour, minute)
else:
View
2  django/utils/http.py
@@ -166,7 +166,7 @@ def int_to_base36(i):
# Construct base36 representation
while factor >= 0:
j = 36 ** factor
- base36.append(digits[i / j])
+ base36.append(digits[i // j])
i = i % j
factor -= 1
return ''.join(base36)
Please sign in to comment.
Something went wrong with that request. Please try again.