tags:

views:

63

answers:

2

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

+1  A: 

Try using

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

Python is case-sensitive.

Note that I have not tried this myself, but after looking at the documentation, I would hazard a guess that your only problem is the case of URL - make sure it is all capitals and you should be fine.

a_m0d
A: 

Is this a Zope question? context.absolute_url() might come close to what the original questioner intended.

Cameron Laird