From 2af75b485db15a8494b040aa04337c052b896cca Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Fri, 8 May 2009 13:39:37 +0000 Subject: Fixed #10825: fixed the 'U' format code to dateformat (and the date/now filter/tag). Thanks to gsong and mir. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10716 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/dateformat.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'django/utils') diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py index 2751d82e83..b2ea71228c 100644 --- a/django/utils/dateformat.py +++ b/django/utils/dateformat.py @@ -11,12 +11,13 @@ Usage: >>> """ +import re +import time +import calendar from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR from django.utils.tzinfo import LocalTimezone from django.utils.translation import ugettext as _ from django.utils.encoding import force_unicode -from calendar import isleap, monthrange -import re, time re_formatchars = re.compile(r'(? 4: - if jan1_weekday == 5 or (jan1_weekday == 6 and isleap(self.data.year-1)): + if jan1_weekday == 5 or (jan1_weekday == 6 and calendar.isleap(self.data.year-1)): week_number = 53 else: week_number = 52 else: - if isleap(self.data.year): + if calendar.isleap(self.data.year): i = 366 else: i = 365 -- cgit v1.3