# HG changeset patch # User paulb # Date 1172701800 0 # Node ID 98bcc9de1d84356f86fcc79560a98884c2f56548 # Parent 2c1fb2568b99b8b6b1c4627714c1dc4f9792d374 [project @ 2007-02-28 22:30:00 by paulb] Added a return value and a docstring to write_month_to_document. Updated copyright information. diff -r 2c1fb2568b99 -r 98bcc9de1d84 XSLTools/XMLCalendar.py --- a/XSLTools/XMLCalendar.py Wed Feb 28 22:29:43 2007 +0000 +++ b/XSLTools/XMLCalendar.py Wed Feb 28 22:30:00 2007 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -Copyright (C) 2005 Paul Boddie +Copyright (C) 2005, 2007 Paul Boddie Additional copyrights for the monthcalendar function: @@ -62,6 +62,13 @@ # XML production functions. def write_month_to_document(doc, root, year, month): + + """ + Write into the document 'doc' appending to the child elements of the 'root' + element, inserting a month calendar based on the specified 'year' and + 'month'. + """ + weeks = monthcalendar(year, month) month_element = root.appendChild(doc.createElement("month")) @@ -86,6 +93,8 @@ day_element.setAttribute("date", "%04d%02d%02d" % (year, month, number)) day_element.setAttribute("number", str(number)) + return month_element + def get_calendar_for_month(year, month): doc = libxml2dom.createDocument(None, "calendar", None) write_month_to_document(doc, doc.childNodes[-1], year, month)