Re: [Zope] [newbie] Property with <dtml-var> in it's value
Hi Dieter Thank you for your answer. I think I haven't explained my problem so clear - sorry. Let's say "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* ... And it looks like the problem is that properties don't get rendered after they have been inserted with dtml-var ... Is it the problem, that I don't see the forrest cause of to many trees - or is it really a problem? Kind Regards Stefan ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Stefan Mallepell" <steve@syso.ch> Sent: Wednesday, April 18, 2001 9:43 PM Subject: Re: [Zope] [newbie] Property with <dtml-var> in it's value
Hi Stefan
Stefan Mallepell writes:
Now I'm looking for a userfriendly possibility to access the information of this "links" out of the content attributes of the other Instances. Sounds easy, isn't it ;) ... It does.
There is, however, a big problem: I do not see yours:
If "i" is a Z Instance and "a" one of its attributes, the "i.a" gives me this attribute.
It your problem to get the Z Instance "i" or to pull out something from "a" or ?
Dieter
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
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 )
participants (2)
-
Dieter Maurer -
Stefan Mallepell