diff --git a/fedocal/fedocallib/__init__.py b/fedocal/fedocallib/__init__.py index 53eaa24a..4cc0d3de 100644 --- a/fedocal/fedocallib/__init__.py +++ b/fedocal/fedocallib/__init__.py @@ -753,8 +753,7 @@ def get_html_monthly_cal( htmlcal = FedocalCalendar(day=day, year=year, month=month, calendar_name=calendar_name, loc_name=loc_name, - busy_days=busy_days, - cur_day=cur_date) + busy_days=busy_days) curmonth_cal_nf = htmlcal.formatmonth() return curmonth_cal_nf diff --git a/fedocal/fedocallib/fedora_calendar.py b/fedocal/fedocallib/fedora_calendar.py index 54561df2..932bfc5b 100644 --- a/fedocal/fedocallib/fedora_calendar.py +++ b/fedocal/fedocallib/fedora_calendar.py @@ -27,8 +27,7 @@ class FedocalCalendar(HTMLCalendar): """ def __init__(self, year, month, day, - calendar_name=None, loc_name=None, busy_days=[], - cur_day=None): + calendar_name=None, loc_name=None, busy_days=[]): """ Constructor. Stores the year and the month asked. """ @@ -37,7 +36,6 @@ def __init__(self, year, month, day, self.month = month self.day = day self.busy_days = busy_days - self.cur_day = cur_day self.calendar_name = calendar_name self.loc_name = loc_name @@ -167,10 +165,7 @@ def formatmonth(self, withyear=True): #item('\n') for week in self.monthdays2calendar(self.year, self.month): days = [day[0] for day in week] - if self.cur_day \ - and self.cur_day.day in days \ - and self.cur_day.month == self.month \ - and self.cur_day.year == self.year: + if self.day in days: item(self.formatweek(week, current=True)) else: item(self.formatweek(week)) diff --git a/tests/test_fedora_calendar.py b/tests/test_fedora_calendar.py index 1f1c76b5..58c81c43 100644 --- a/tests/test_fedora_calendar.py +++ b/tests/test_fedora_calendar.py @@ -89,59 +89,74 @@ def test_formatmonthname(self): def test_formatmonth(self): """ Test the formatmonth function. """ cal = FedocalCalendar(2012, 1, 10) - self.assertEqual( - cal.formatmonth(), - '\n\n\n\n\n16\n' - '\n' - '' - '' - '\n
' - 'January 2012
  ' - ' ' - '  ' - ' 1
23' - '45678
9101112131415
171819202122
23242526272829
3031     
\n') - self.assertEqual( - cal.formatmonth(False), - '\n\n\n\n\n16\n' - '\n' - '' + expcal = [ + '
' - ' January
  ' - ' ' - '  ' - ' 1
23' - '45678
9101112131415
171819202122
23242526272829
3031  
', + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' '' - '\n
January 2012
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
\n') + ' ', + '', ''] + callines = cal.formatmonth().split('\n') + + self.assertEqual(len(expcal), len(callines)) + for cnt in range(0, len(callines)): + self.assertEqual(expcal[cnt], callines[cnt]) + + expcal = [ + '', + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '' + '' + '' + '', + '
January
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
', ''] + callines = cal.formatmonth(withyear=False).split('\n') + + self.assertEqual(len(expcal), len(callines)) + for cnt in range(0, len(callines)): + self.assertEqual(expcal[cnt], callines[cnt]) if __name__ == '__main__':