Django

Code

Changeset 5671

Show
Ignore:
Timestamp:
07/12/07 08:55:19 (1 year ago)
Author:
russellm
Message:

Fixed #4768 -- Converted timesince and dateformat to use explicit floor division (pre-emptive avoidance of Python 3000 compatibility problem), and removed a redundant millisecond check. Thanks, John Shaffer <jshaffer2112@gmail.com>.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r5663 r5671  
    226226    scott@staplefish.com 
    227227    serbaut@gmail.com 
     228    John Shaffer <jshaffer2112@gmail.com> 
    228229    Pete Shinners <pete@shinners.org> 
    229230    Jozko Skrablin <jozko.skrablin@gmail.com> 
  • django/trunk/django/utils/dateformat.py

    r5609 r5671  
    228228            else: 
    229229                j = day_of_year + (7 - weekday) + (jan1_weekday - 1) 
    230                 week_number = j /
     230                week_number = j //
    231231                if jan1_weekday > 4: 
    232232                    week_number -= 1 
  • django/trunk/django/utils/timesince.py

    r5609 r5671  
    3434    since = delta.days * 24 * 60 * 60 + delta.seconds 
    3535    for i, (seconds, name) in enumerate(chunks): 
    36         count = since / seconds 
     36        count = since // seconds 
    3737        if count != 0: 
    3838            break 
    39     if count < 0: 
    40         return ugettext('%d milliseconds') % math.floor((now - d).microseconds / 1000) 
    4139    s = ugettext('%(number)d %(type)s') % {'number': count, 'type': name(count)} 
    4240    if i + 1 < len(chunks): 
    4341        # Now get the second item 
    4442        seconds2, name2 = chunks[i + 1] 
    45         count2 = (since - (seconds * count)) / seconds2 
     43        count2 = (since - (seconds * count)) // seconds2 
    4644        if count2 != 0: 
    4745            s += ugettext(', %(number)d %(type)s') % {'number': count2, 'type': name2(count2)}