[Zope-CMF] CMFCalender and monthRange Probs

Marc Fischer marcbpc@gmx.de
Thu, 23 Aug 2001 10:25:43 +0200 (MEST)


I works, I just addes "dt" in the parameter list :-)))



> Hi I have problems with the monthRange.py from the HowTo: 
> 
> http://cmf.zope.org/Members/frankmc/UsingCalendarTag
> 
> I use CMFCalendar 0.2 and tried nearly all versions of the monthRange.py
> :-(
> 
> I just followed this hint:
> -------------------------
> Notes
> 1. If you want you can paste the monthRange code into Zope directly but it
> needs modifications. In the Zope management interface, you must add 'dt'
> as a
> parameter to the function and paste in the following code :
> 
> >from DateTime import DateTime
> month_len =((0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31), 
> (0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31))
> """
> Return a pair of DateTime values representing the
> earliest and latest times in the month in which 'dt'
> falls.
> """
> y, m, d = dt.year(), dt.month(), dt.day()
> first = DateTime( y, m, 1 )
> last = first - 1 + month_len[ dt.isLeapYear() ][ m ]
> return first.earliestTime(), last.latestTime()
> 
> 
> The reason to modify the code is to get around the inability to get to the
> DateTime._month_len attribute because of the Zope engines restrictions. 
> -----------------------
> 
> but if I try to view the calendar DTML I get the message:
> 
> monthRange() takes no arguments (1 given)
> 
> ... what to do? Do I have to modify the calendar file, where monthRange is
> calles with an argument???
> 
> Thanks for your help ... a frustrated Python Newbie :-)))
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
> 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests
> 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net