[Zope-dev] Strings as input to the in tag: inconsistent

Martijn Pieters mj@antraciet.nl
Mon, 31 May 1999 09:36:07 +0200


At 18:54 30/05/99 , Thilo Mezger wrote:
>Jim Fulton wrote:
>
> > No. I can't even believe it. ;) I certainly can't repoduce it.
> > The in tag is not willing to iterate over a string and _.string.uppercase
> > is a string.
>
>again, i have created a dtml document which looks like this:
>
>         <!--#var standard_html_header-->
>         <h2><!--#var title_or_id--></h2>
>         <p>
>         <!--#in mystring-->
>           <!--#var sequence-item-->
>         <!--#/in-->
>         </p>
>         <!--#var standard_html_footer-->
>
>"mystring" is a string property of this document and the in tag is
>iterating over this string just like you would expect python to iterate
>over a string.

Puzzling indeed. Somewhere the test fails.. Could you do some debugger 
tracing or something? In DT_In.py, around the import lines, add 'import 
pdb', and in the renderwob method (renderwb without an 'o' is for #in tags 
in batch mode (i.e. using the size attribute), you should add the line 
'pdb.set_trace()' somewhere at the beginning, or at least before the test 
for string type. Now restart your Zope server.

When you now load the DTML Document, you'll notice that your browser will 
wait for the document. At the prompt where you started Zope, the Python 
Debugger prompt will be waiting for input. 's' is one step, 'n' is stepping 
over (do not go into a subroutine), 'r' is return from this method (it will 
first jump to the point where it is about to return) and 'c' is continue.

Now you can step to the test, and because you are in python, do some 
testing yourself. Let us know the results!

When you're done, you might have to hit 'c' several times, because of the 
fact that ZServer is multi-threaded. Remove the debugging code from 
DT_In.py, and restart your server. Again, it may be that you have to coax 
ZServer along with some more returns (repeats last command) or 'c's (when 
the last command has been blanked because you hit another 
'pdb.set_trace()'), before it actually will restart.

>no problems at all and i find this very convenient.

I would find it convenient as well, but I think DC had a reason to exclude 
string sequences. DC?


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------