Hi Dieter I will try this, but unfortunately I don't have any time today. Thank you for your help. Stefan ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Stefan Mallepell" <steve@syso.ch> Cc: <zope@zope.org> Sent: Thursday, April 19, 2001 8:03 PM Subject: Re: [Zope] [newbie] Property with <dtml-var> in it's value
Stefan Mallepell writes:
"A" is the object-instance with a property "l" which contains 'http://www.externalserver.org' and the id 'externalserver' "B" is another object-instance with a property "c" which contains 'This is text with some links. The links to the *externalserver* can be in the middle of the text.'
In my index_html I show "c" an would like to generate a proper "a href" around *externalserver* ... You have 3 problems - all solvable:
1. locate the ranges in "c" to be replaced by "a href=..." 2. find the link for an id ("externalserver" in your example) 3. insert the links into "c"
For 1. and 3. you would use Python's "re" module (regular expressions), more precisly, the "sub" method (for "substitute"). You find documentation on "re" in the Python library documentation (--> www.python.org).
As it is not too difficult to create long running regular expressions, "re" was considered too dangerous to expose it to DTML or Python Script. Thus, you will either need an External Method or learn how to make additional modules accessible from Python Script (--> searchable mailing list archives).
If you have an "id" and you want to get the corresponding object, you can use "_.getitem(id)". Thus, if "id" contains "externalserver", then "_.getitem(id).l" will be equivalent to "externalserver.l", the "l" attribute of "externalserver". This solves 2.
Dieter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )