Python: Obtain a URL

你离开我真会死。 提交于 2019-12-12 04:28:42

问题


Because I cant get this working: Python: KeyError with form.getfirst

I have an alternative option, I have a function in DTML which needs to obtain a URL:

For example if the dtml webpage is located at

www.blah.com/foo/foo2?variable=55

How would i obtain the URL of this page using a python function?

The function is called by:

<dtml-var test>

The syntax for "test" is rite, the Zope documentation says so.


回答1:


for: http://www.blah.com/foo/foo2?job_ID=55555&test=1

<dtml-var URL> = http://www.blah.com/foo/foo2

<dtml-var QUERY_STRING> = job_ID=55555&test=1

<dtml-var "REQUEST['job_ID']"> = 55555

See: http://wiki.zope.org/zope2/REQUESTX



来源:https://stackoverflow.com/questions/3251020/python-obtain-a-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!