On Mon, 24 Jul 2000, Jonothan Farr wrote:
> I couldn't reproduce this. The following code works for me in Zope 2.1.6,
> verbatim.

Ah-ha!  It was on 2.2.0 that this code failed.  And.. sure enough, a quick
check on the Zope 2.1.6 install I still have around shows that the code works
there for me as well.  Thank goodness; I was pulling my hair out trying to
figure out what I was doing wrong, but it seems likely to be a bug in the new
release that was causing my problem.

> <dtml-var standard_html_header>
> <dtml-call "REQUEST.set('spec', '*')">
> <dtml-call "REQUEST.set('num_dir_columns', 3)">
> <table>
> <dtml-call "REQUEST.set('ctr', 0)">
> <dtml-in "local.fileValues(REQUEST.get('spec', _.None))">
>   <dtml-if "type == 'directory'">
>     <dtml-if "ctr % num_dir_columns == 0">
>       <tr>
>     </dtml-if>
>     <td><a href="<dtml-var URL1>/<dtml-var url>"><dtml-var "id"></a><br>
>     <dtml-if "ctr % num_dir_columns == num_dir_columns - 1">
>       </tr>
>     </dtml-if>
>     <dtml-call "REQUEST.set('ctr', _.int(ctr) + 1)">
>   </dtml-if>
> </dtml-in>
> <dtml-comment> In case we end in the middle of a row... </dtml-comment>
> <dtml-if "ctr % num_dir_columns != 0">
>   </tr>
> </dtml-if>
> </table>
> <dtml-var standard_html_footer>
> Maybe you can play with this as a starting point.
> I added a couple of REQUEST.set() calls at the top to simulate variables passed
> from a form, I assume.
> 'local' is my LocalFS object. Are you using this code in a <dtml-with> statement
> or are you actually serving it as a .dtml file from the local file system?

It may be academic now, but I'm using it in a .dtml file that is called as a
method by a python product.  Actually, what I'm doing is hacking LocalFS to be
an image gallery, so that all I have to do is drop a bunch of image files in a
certain directory on my hard drive and they'll show up on the www all
thumbnailed and prettified, via the magic of Zope.  The code that you saw is
from my replacement for the 'methodBrowse.dtml' file in the LocalFS product.  I
know that there are some other PhotoAlbum type products out there that do
something similar, but I wanted the exercise.

Thanks for your help... I guess now I report this as a bug.  I've seen some
mention of a "Collector" for this sort of thing; I'll go dig around zope.org
(as soon as it comes back up) to find out what that is and how to use it. 
Unless of course any Zen masters notice this thread and decide to tackle the
problem straightaway... ;-]


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to