Re: [Zope] how to build a search date range parameter in a search form
That's what I can't dothe tuple gets passed as a string... :-( as far as I understand Lucia On 4/3/06, Dieter Maurer [EMAIL PROTECTED] wrote: Lucia Colombo wrote at 2006-4-3 17:49 +0200:I'm trying to build a search form which gets as an input a year and searches for all objects which have a (custom) date index set within such year. ...How do I get the parameter to be a list of dates?You determine start and end date inside a Python script from the integer year form variable. Then, you form a sequence(list or tuple) from the two dates.--Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to build a search date range parameter in a search form
At Monday 3/4/2006 12:49, Lucia Colombo wrote: select name= getAnno.query:record:list id=getAnno tabindex= tal:attributes=tabindex tabindex/next; tal:options repeat=year years_list option value=# tal:define=start_date python:DateTime(int(year), 1, 1); end_date python:DateTime(int(year), 12, 31); date_range python:[start_date, end_date]; tal:attributes=value date_range tal:content=year 2000 /option /tal:options /select How do I get the parameter to be a list of dates? You can't. :list joins multiple parameters into a single list, but an option gives just a single parameter. But you don't need such things - you can compute start_date and end_date trivially (inside the form action) from the *only* integer parameter you need, the year. Gabriel Genellina Softlab SRL ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] how to build a search date range parameter in a search form
Hi all I'm trying to build a search form which gets as an input a year and searches for all objects which have a (custom) date index set within such year. So after having built a list of the available years to query on, I added in the search form: select name= getAnno.query:record:list id=getAnno tabindex= tal:attributes=tabindex tabindex/next; tal:options repeat=year years_list option value=# tal:define=start_date python:DateTime(int(year), 1, 1); end_date python:DateTime(int(year), 12, 31); date_range python:[start_date, end_date]; tal:attributes=value date_range tal:content=year 2000 /option /tal:options /select input type=hidden name= getAnno.range:record value=minmax / (getAnno is my custom date index) but then I get into the query the string [DateTime(2006/01/01), DateTime(2006/12/31)] instead of the list of dates. Actually what I get is a syntaz error, as it is: getAnno {'query': [[DateTime('2005/01/01'), DateTime('2005/12/31')]], 'range': 'minmax'} How do I get the parameter to be a list of dates? thanksbye Lucia ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to build a search date range parameter in a search form
Lucia Colombo wrote at 2006-4-3 17:49 +0200: I'm trying to build a search form which gets as an input a year and searches for all objects which have a (custom) date index set within such year. ... How do I get the parameter to be a list of dates? You determine start and end date inside a Python script from the integer year form variable. Then, you form a sequence (list or tuple) from the two dates. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )