[Zope] lines property

Loren Stafford lstafford@icompression.com
Wed, 6 Oct 1999 12:51:04 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_001E_01BF0FF9.731E4460
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

You probably want the strings module documented at:

http://www.zope.org/Documentation/Guides/DTML/DTML-HTML/DTML.3.3.2.3.html

BTW, many list members have difficulty responding to HTML encoded emails, so
better to send plain text to this list.

-- Loren
    -----Original Message-----
    From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Kevin
Howe
    Sent: Wednesday, October 06, 1999 12:00
    To: zope@zope.org
    Subject: Re: [Zope] lines property


    Hi, I currently have a lines property with a ZOPE path on each line, and
the following statement which works:

    "Paths" Lines Property
    -----------------------------
    /path/one
    /path/two

    DTML Code
    ----------------------------
    <!--#if "_['sequence-item'] == PATH_INFO "-->
       Match - <!--#var sequence-item--><br>
    <!--#else-->
       No Match - <!--#var sequence-item--><br>
    <!--#/if-->

    In this case, there is a match if the current Zope PATH_INFO is equal to
"/path/one" or "/path/two", exact matches only. A path of
"/path/one/folder/" is not a match, because it's not exact.

    What I would like to do a substring search for a match, instead of a
full comparison, something like this:

    <!--#if "PATH_INFO (STARTS WITH) _['sequence-item']"-->
       Match - <!--#var sequence-item--><br>
    <!--#else-->
       No Match - <!--#var sequence-item--><br>
    <!--#/if-->

    In this example, a PATH_INFO of "/path/one/folder" would be a match,
beause it starts with "/path/one", which is one of the given values.

    I tried playing with the Python search() and match() functions, but
couldnt get them to work.
    Can someone tell me how/if this type of matching can be done?

    Much appreciated,
    KH





------=_NextPart_000_001E_01BF0FF9.731E4460
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 =
HTML//EN">
<META content=3D'"MSHTML 4.72.3612.1700"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D470454919-06101999><FONT color=3D#0000ff face=3DArial =
size=3D2>You=20
probably want the strings module documented at:</FONT></SPAN></DIV>
<DIV><SPAN class=3D470454919-06101999><FONT color=3D#0000ff face=3DArial =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff size=3D2><A=20
href=3D"http://www.zope.org/Documentation/Guides/DTML/DTML-HTML/DTML.3.3.=
2.3.html">http://www.zope.org/Documentation/Guides/DTML/DTML-HTML/DTML.3.=
3.2.3.html</A></FONT></DIV>
<DIV><FONT color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D470454919-06101999><FONT color=3D#0000ff face=3DArial =
size=3D2>BTW,=20
many list members have difficulty responding to HTML encoded emails, so =
better=20
to send plain text to this list.</FONT></SPAN></DIV>
<DIV><SPAN class=3D470454919-06101999><FONT color=3D#0000ff face=3DArial =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D470454919-06101999><FONT color=3D#0000ff face=3DArial =
size=3D2>--=20
Loren</FONT></SPAN></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #0000ff solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
    <DIV class=3DOutlookMessageHeader><FONT face=3D"Times New Roman"=20
    size=3D2>-----Original Message-----<BR><B>From:</B> =
zope-admin@zope.org=20
    [mailto:zope-admin@zope.org]<B>On Behalf Of</B> Kevin =
Howe<BR><B>Sent:</B>=20
    Wednesday, October 06, 1999 12:00<BR><B>To:</B>=20
    zope@zope.org<BR><B>Subject:</B> Re: [Zope] lines=20
    property<BR><BR></FONT></DIV>
    <DIV><FONT size=3D2>Hi, I currently have a lines property with a =
ZOPE path on=20
    each line, and the following statement which works:</FONT></DIV>
    <DIV><FONT size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT color=3D#000000 size=3D2>&quot;Paths&quot; Lines=20
Property</FONT></DIV>
    <DIV><FONT size=3D2></FONT><FONT color=3D#000000=20
    size=3D2>-----------------------------</FONT></DIV>
    <DIV><FONT size=3D2>/path/one</FONT></DIV>
    <DIV><FONT size=3D2>/path/two</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT size=3D2>DTML Code</FONT></DIV>
    <DIV><FONT size=3D2></FONT><FONT color=3D#000000=20
    size=3D2>----------------------------</FONT></DIV>
    <DIV><FONT color=3D#000000 size=3D2>&lt;!--#if =
&quot;_['sequence-item'] =3D=3D=20
    PATH_INFO &quot;--&gt;<BR>&nbsp;&nbsp; Match - &lt;!--#var=20
    sequence-item--&gt;&lt;br&gt;<BR>&lt;!--#else--&gt;<BR>&nbsp;&nbsp; =
No Match=20
    - &lt;!--#var=20
sequence-item--&gt;&lt;br&gt;<BR>&lt;!--#/if--&gt;</FONT></DIV>
    <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT color=3D#000000 size=3D2>In this case, there is a match =
if the=20
    current Zope PATH_INFO is equal to &quot;/path/one&quot; or=20
    &quot;/path/two&quot;, exact matches only. A path of=20
    &quot;/path/one/folder/&quot; is not a match, because it's not=20
    exact.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT color=3D#000000 size=3D2>What I would like to do a =
substring search=20
    for a match, instead of a full comparison, something like =
this:</FONT></DIV>
    <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT color=3D#000000 size=3D2>
    <DIV><FONT color=3D#000000 size=3D2>&lt;!--#if &quot;PATH_INFO =
(STARTS WITH)=20
    _['sequence-item']&quot;--&gt;<BR>&nbsp;&nbsp; Match - &lt;!--#var=20
    sequence-item--&gt;&lt;br&gt;<BR>&lt;!--#else--&gt;<BR>&nbsp;&nbsp; =
No Match=20
    - &lt;!--#var=20
sequence-item--&gt;&lt;br&gt;<BR>&lt;!--#/if--&gt;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV>In this example, a PATH_INFO of &quot;/path/one/folder&quot; =
would be a=20
    match, beause it starts with &quot;/path/one&quot;, which is one of =
the=20
    given values.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>I tried playing with the Python search() and match() functions, =
but=20
    couldnt get them to work. </DIV>
    <DIV>Can someone tell me how/if this type of matching can be =
done?</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>Much appreciated,</DIV>
    <DIV>KH</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;</DIV></FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_001E_01BF0FF9.731E4460--