1.1 --- a/EventAggregatorSupport.py Sun Jan 16 03:10:14 2011 +0100
1.2 +++ b/EventAggregatorSupport.py Sun Jan 16 19:30:01 2011 +0100
1.3 @@ -213,6 +213,17 @@
1.4
1.5 return start_year_default, end_year_default
1.6
1.7 + def get_day_defaults(self, default_as_current=0):
1.8 +
1.9 + "Return defaults for the start and end days."
1.10 +
1.11 + form = self.get_form()
1.12 +
1.13 + start_day_default = form.get("start-day", [default_as_current and getCurrentDate().day() or ""])[0]
1.14 + end_day_default = form.get("end-day", [default_as_current and start_day_default or ""])[0]
1.15 +
1.16 + return start_day_default, end_day_default
1.17 +
1.18 def get_form(request):
1.19
1.20 "Work around disruptive MoinMoin changes in 1.9."
1.21 @@ -1516,7 +1527,14 @@
1.22 return None
1.23
1.24 def getDate(s):
1.25 - return getDateTime(s).as_date()
1.26 +
1.27 + "Parse the string 's', extracting and returning a date object."
1.28 +
1.29 + dt = getDateTime(s)
1.30 + if dt is not None:
1.31 + return dt.as_date()
1.32 + else:
1.33 + return None
1.34
1.35 def getDateTime(s):
1.36
1.37 @@ -1694,6 +1712,22 @@
1.38 else:
1.39 return None
1.40
1.41 +def getFormDateTriple(request, yeararg, montharg, dayarg):
1.42 +
1.43 + """
1.44 + Return the date from the 'request' for the calendar with the given
1.45 + 'calendar_name' using the parameters having the given 'yeararg', 'montharg'
1.46 + and 'dayarg' names.
1.47 + """
1.48 +
1.49 + year = getParameter(request, yeararg)
1.50 + month = getParameter(request, montharg)
1.51 + day = getParameter(request, dayarg)
1.52 + if year and month and day:
1.53 + return Date((int(year), int(month), int(day)))
1.54 + else:
1.55 + return None
1.56 +
1.57 def getFormMonthPair(request, yeararg, montharg):
1.58
1.59 """