[Zope] "REQUEST" a string object?

Rob Miller rob@kalistra.com
Tue, 25 Jul 2000 12:10:22 -0700


On Tue, 25 Jul 2000, Dieter Maurer wrote:
> Rob Miller writes:
>  > <table>
>  > <dtml-call "REQUEST.set('ctr', 0)">
>  > <dtml-in "fileValues(REQUEST.get('spec', _.None))">
>  >     ....
>  >     <dtml-call "REQUEST.set('ctr', _.int(ctr) + 1)">
>  > ....
> There are "sequence-index" and "sequence-number" variables
> defined by "dtml-in". Thus, you need not count yourself.
> Note: use as "_['sequence-*']" inside "...".

I don't think this works for me though, because I don't want to count all of
the sequence items, just the ones that match a certain criterion. 
Specifically, I'm stepping through all of the files in a directory, but I'm
only displaying (and thus counting) the ones that are themselves directories. 
Is there a way to leverage the "sequence-" variables to help me here?

> 
>  > The error I get, running Zope in debug mode, is this:
>  > 
>  >    Error Type: AttributeError
>  >    Error Value: 'string' object has no attribute 'set'
> Is is possible that some of your folders has
> a REQUEST property or acquires it?

No, that's not the case.  Nice thought, though.

I've discovered (with Jonothan Farr's help) that the problem doesn't occur in
Zope 2.1.6, only in 2.2.0.  This leads me to think that a) it's a new bug in
2.2.0 I've uncovered or b) there's something different about the way Zope 2.2.0
handles the REQUEST object that I need to understand and account for.

I've discovered (quite by accident) that an attempt to add a Squishdot
installation (Squishdot-0-4-1) into Zope 2.2.0 generates the same error that my
code generates.  There's a note on the Squishdot page that indicates that they
know it doesn't yet work with 2.2.0, and that it will soon be resolved (by
Squishdot-0-4-4, they promise).  There's no indication, though, of whether the
Squishdot author(s) know what the problem is at this point.

I'm considering making a post to Zope-dev describing the problem and asking if
anyone knows whether this is a feature or a bug that I'm bumping into.

rob

(p.s.  I've just had a thought that I might be able to force the
<dtml-in> loop to sort the files by type, which would at least guarantee that
all of the directories would be consecutive.  I could also maybe construct a
new list of just the directories and then iterate over the new list.  Either of
these may allow me to use the "sequence-" values constructively.  I want to
learn what's going on here, though, and I'd rather not have to resort to
complicating my algorithms.  Counting stuff is a basic programming task, it
should be able to be accomplished in a straightforward manner.)