I don't have to use os.environ
but that might be the easiest method.
I can successfully get the previous URL using:
sURL = os.getenv('HTTP_REFERER')
and the arguments of the current string using:
sURL = os.environ['QUERY_STRING']
but I cannot get the current URL.
Other answers here advise:
sURL = self.request.url
(or self.request.host) but when I do that I get:
sURL = self.request.url NameError: global name 'self' is not defined
How can I easily get the current URL?
Full code:
import os
def GetTestMode ():
sURL = self.request.url
print '<br />sURL = ' + sURL + '<br />'