Tim Cook wrote:
-----------------------------------------------------------------------------
Notice in add_weekly the <dtml-call day_list>. It does nothing but with out it I get this traceback:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: __getitem__
Traceback (innermost last): File /usr/local/zope/2.2/lib/python/ZPublisher/Publish.py, line
(Object: done_list) File /usr/local/zope/2.2/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval (Object: _['sequence-item'] in day_list) (Info: day_list) File <string>, line 0, in ? AttributeError: (see above)
------------------------------------------------------------------ DTML METHOD: period_begin Selects a set of dates in the past 41 days that are either the first day of the month or a Sunday. Returns the list.
<snip>
------------------------------------------------------- DTML METHOD: add_weekly Input form to report weekly activities.
--------->>>>>> <dtml-call "REQUEST.set('day_list', period_begin)">
<dtml-call "REQUEST.set('done_list', [])">
<dtml-call day_list>
<dtml-in done_list> <dtml-if "_['sequence-item'] in day_list"> <dtml-call "day_list.remove(_['sequence-item'])"> </dtml-if> </dtml-in>
.... more code here that uses day_list in a <SELECT></SELECT> and takes more form input. ...
Is this a bug or should I clean up my code??? <s>
When you call request.set your setting daylist to the method not the results of the method. try switching it to <dtml-call "REQUEST.set('day_list', period_begin(_.None, _))"> Kapil