[Zope] Location of sequence-previous, sequence-next

Shaw, Howard ShawH@STHS.org
Wed, 17 Feb 1999 07:02:52 -0600


I have not looked at the internal code, so I don't know what is
involved, but I would very much prefer it if the 'sequence-previous'
data and the 'sequence-next' data were each available at every phase of
the <!--#in--> tag.

I would like to do:
<!--#in this_and_that-->
 <tr>
  <td>Blah  </td>
  <td>Blah  </td>
  <td>Blah  </td>
  <td>Blah  </td>
 </tr>
 <!--#if sequence-end-->
   Previous href               Next href
 <!--#/if-->
<!--#/in-->

where basically both the previous pointer and the next pointer show up
at the end of the table. At the moment I am using this kludge:

<!--#if expr="year and not last"-->
<!--#in email_index size=20 start=query_start-->
 <tr>
  <td><!--#var year--></td>
  <td><!--#var full_name--></td>
  <td><a href="mailto:<!--#var home_emails-->"><!--#var
home_emails--></td>
  <td><a href="mailto:<!--#var b_emails-->"><!--#var b_emails--></td>
 </tr>
<!--#/in-->
<!--#else-->
<!--#in email_index size=20 start=query_start-->
 <tr>
  <td><!--#var full_name--></td>
  <td><!--#var year--></td>
  <td><a href="mailto:<!--#var home_emails-->"><!--#var
home_emails--></td>
  <td><a href="mailto:<!--#var b_emails-->"><!--#var b_emails--></td>
 </tr>
<!--#/in-->
<!--#/if-->

<tr><td colspan=4><table width=100%><tr>
<!--#in email_index size=20 start=query_start-->
 <!--#if sequence-start-->
  <!--#if previous-sequence-->
   <td><center><a href="<!--#var URL--><!--#var
sequence-query-->query_start=<!--#var
previous-sequence-start-number-->">Previous</a></center></td>
  <!--#else-->
   <td><center>Previous</center></td>
  <!--#/if-->
 <!--#/if-->
 <!--#if sequence-end-->
  <!--#if next-sequence-->
   <td><center><a href="<!--#var URL--><!--#var
sequence-query-->query_start=<!--#var
next-sequence-start-number-->">Next</a></center></td>
  <!--#else-->
   <td><center>Next</center></td>
  <!--#/if-->
 <!--#/if-->
<!--#/in-->

I don't know what the overhead is for performing that <!--#in
email_index--> twice, but I don't like it. It makes the code look
kludgey and is a pain to work with.

This code would be much cleaner and more understandable if the
'previous-sequence' stuck around until 'sequence-end'. Or for that
matter, if there was a way, within an if block, to set variables in the
surrounding namespace as opposed to an internal #with grouping. Then I
could do like this:

<!--#in this_and_that-->
 <tr>
  <td>Blah  </td>
  <td>Blah  </td>
  <td>Blah  </td>
  <td>Blah  </td>
 </tr>
 <!--#if sequence-start-->
   Set 'my_previous_blah' equal to 'previous_blah'
 <!--#/if-->
 <!--#if sequence-end-->
   Previous href (using my_sequence-prev)              Next href (using
sequence-next)
 <!--#/if-->
<!--#/in-->

which would still be a kludge, and yet still be easier to understand.