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 '
- 'January 2012 |
\n | '
- ' | | '
- ' | | '
- ' | 1 |
\n2 | 3 | '
- '4 | 5 | 6 | 7 | 8 |
\n9 | 10 | 11 | 12 | 13 | 14 | 15 |
\n16 | 17 | 18 | 19 | 20 | 21 | 22 |
\n23 | '
- '24 | 25 | 26 | 27 | 28 | 29 |
\n'
- '30 | 31 | | | '
- ' | | '
- ' |
\n
\n')
- self.assertEqual(
- cal.formatmonth(False),
- '\n'
- ' January |
\n | '
- ' | | '
- ' | | '
- ' | 1 |
\n2 | 3 | '
- '4 | 5 | 6 | 7 | 8 |
\n9 | 10 | 11 | 12 | 13 | 14 | 15 |
\n16 | 17 | 18 | 19 | 20 | 21 | 22 |
\n23 | '
- '24 | 25 | 26 | 27 | 28 | 29 |
\n'
- '30 | 31 | | | '
+ expcal = [
+ '',
+ ' January 2012 |
',
+ ' | | '
+ ' | | '
+ ' | | '
+ '1 |
',
+ '2 | 3 | '
+ '4 | 5 | '
+ '6 | 7 | '
+ '8 |
',
+ '9 | '
+ '10 | 11 | '
+ '12 | 13 | '
+ '14 | 15 |
',
+ '16 | 17 | '
+ '18 | 19 | '
+ '20 | 21 | '
+ '22 |
',
+ '23 | 24 | '
+ '25 | 26 | '
+ '27 | 28 | '
+ '29 |
',
+ '30 | 31 | '
+ ' | | '
' | | '
- ' |
\n
\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 |
',
+ '2 | 3 | '
+ '4 | 5 | '
+ '6 | 7 | '
+ '8 |
',
+ '9 | '
+ '10 | 11 | '
+ '12 | 13 | '
+ '14 | 15 |
',
+ '16 | 17 | '
+ '18 | 19 | '
+ '20 | 21 | '
+ '22 |
',
+ '23 | 24 | '
+ '25 | 26 | '
+ '27 | 28 | '
+ '29 |
',
+ '30 | 31 | '
+ ' | | '
+ ' | | '
+ ' |
',
+ '
', '']
+ 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__':