Hi, everybody! Please, advise, can I somehow get an anchor from the URL in dtml method (or python script), e.g. have URL: http://localhost:8080/mysite/index_html#18 I have to get the value of anchor, but how ? Thanks. Sincerely yours, Alexander Y. Klimovich
You could get the URL from the request and call the split function from the string module. Klimovich Alexander wrote:
Hi, everybody!
Please, advise, can I somehow get an anchor from the URL in dtml method (or python script), e.g. have URL: http://localhost:8080/mysite/index_html#18 I have to get the value of anchor, but how ?
Thanks.
Sincerely yours, Alexander Y. Klimovich
_______________________________________________ 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 )
Use the urlparse module: http://www.python.org/doc/current/lib/module-urlparse.html urlparse (urlstring[, default_scheme[, allow_fragments]]) -- function of module urlparse Parse a URL into 6 components, returning a 6-tuple: (addressing scheme, network location, path, parameters, query, fragment identifier). This corresponds to the general structure of a URL: scheme://netloc/path;parameters?query#fragment. eg:
from urlparse import urlparse urlparse('http://http://localhost:8080/mysite/index_html#18')[-1] 18 -- Andy McKay
Klimovich Alexander wrote at 2003-1-15 19:34 +0200:
Please, advise, can I somehow get an anchor from the URL in dtml method (or python script), e.g. have URL: http://localhost:8080/mysite/index_html#18 I have to get the value of anchor, but how ? The "anchor"s are not part of the URL (but only of URL references). The URL reference lives in the browser (or your HTML). The browser sends only the URL to the server (without the anchor).
No chance.... Dieter
participants (4)
-
Andy McKay -
Dieter Maurer -
Kevin Carlson -
Klimovich Alexander