[Zope] lines property

Kevin Howe khowe@performance-net.com
Wed, 6 Oct 1999 15:59:47 -0300


This is a multi-part message in MIME format.

------=_NextPart_000_0123_01BF1013.D0758910
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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'] =3D=3D 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.=20
Can someone tell me how/if this type of matching can be done?

Much appreciated,
KH





------=_NextPart_000_0123_01BF1013.D0758910
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.2106.6"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi, I currently have a lines property with a ZOPE =
path on each=20
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 =
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 PATH_INFO=20
&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 =
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 current=20
Zope PATH_INFO is equal to &quot;/path/one&quot; or =
&quot;/path/two&quot;, exact=20
matches only. A path of &quot;/path/one/folder/&quot; is not a match, =
because=20
it's not exact.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>What I would like to do a substring =
search for a=20
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 =
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 =
given=20
values.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I tried playing with the Python search() and match() functions, but =
couldnt=20
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></BODY></HTML>

------=_NextPart_000_0123_01BF1013.D0758910--