1

Whats the simpliest way to obtain the URL of the webpage you are currently on?

For example if i have a python function and i call it from within a webpage, whats the best way to obtain the URL. What maybe an easier question how is how do you obtain the variables passed within the URL i.e. after the "?"

I've tried calling:

def return_query(self):
    self.request.url

I have also tried

def return_query2(self):
    self.request.query_string

But i get a attrbiute error for request

4

2 回答 2

1

这是 Zope 的问题吗?context.absolute_url() 可能接近原始提问者的意图。

于 2010-10-04T01:06:36.423 回答
1

尝试使用

def return_query(self):
    return self.request.URL

Python 区分大小写。

请注意,我自己没有尝试过,但是在查看文档之后,我会冒险猜测您唯一的问题是URL- 确保它都是大写字母,您应该没问题。

于 2010-09-06T07:54:20.193 回答