From 699688dc2cfad627c5d400c6bdb681c81e932bc0 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 9 Sep 2011 21:45:58 +0000 Subject: [PATCH] Switch to using explicit new-style division behavior, rather than relying on teh classic behavior. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16745 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/humanize/templatetags/humanize.py | 12 ++++++------ django/contrib/localflavor/se/utils.py | 2 +- django/utils/baseconv.py | 2 +- django/utils/feedgenerator.py | 4 ++-- django/utils/http.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 8e25554aeab..0da7e8e4533 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/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} diff --git a/django/contrib/localflavor/se/utils.py b/django/contrib/localflavor/se/utils.py index 5f65d8fcb22..5e7c2b7dae6 100644 --- a/django/contrib/localflavor/se/utils.py +++ b/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): """ diff --git a/django/utils/baseconv.py b/django/utils/baseconv.py index 702c172b34f..8a6181bb2d8 100644 --- a/django/utils/baseconv.py +++ b/django/utils/baseconv.py @@ -88,7 +88,7 @@ class BaseConverter(object): 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) diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 28a83f2f426..aa3a729a8a4 100644 --- a/django/utils/feedgenerator.py +++ b/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: diff --git a/django/utils/http.py b/django/utils/http.py index 4fee731d0a3..af44ff498ca 100644 --- a/django/utils/http.py +++ b/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)