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
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
participants (2)
-
Kevin Howe -
Loren Stafford