equal
deleted
inserted
replaced
20 __authors__ = [ |
20 __authors__ = [ |
21 '"Todd Larsen" <tlarsen@google.com>', |
21 '"Todd Larsen" <tlarsen@google.com>', |
22 ] |
22 ] |
23 |
23 |
24 |
24 |
25 import os |
|
26 import urlparse |
25 import urlparse |
|
26 |
|
27 from soc.logic import system |
27 |
28 |
28 |
29 |
29 def getSingleIndexedParamValue(request, param_name, values=()): |
30 def getSingleIndexedParamValue(request, param_name, values=()): |
30 """Returns a value indexed by a query parameter in the HTTP request. |
31 """Returns a value indexed by a query parameter in the HTTP request. |
31 |
32 |
117 |
118 |
118 if not http_from: |
119 if not http_from: |
119 # no HTTP referrer, so cannot possibly start with expected prefix |
120 # no HTTP referrer, so cannot possibly start with expected prefix |
120 return False |
121 return False |
121 |
122 |
122 http_host = 'http://%s/%s' % (os.environ['HTTP_HOST'], url_name) |
123 http_host = 'http://%s/%s' % (system.getHostname(), url_name) |
123 |
124 |
124 if http_from.startswith(http_host): |
125 if http_from.startswith(http_host): |
125 return True |
126 return True |
126 |
127 |
127 from_path = urlparse.urlparse(http_from).path |
128 from_path = urlparse.urlparse(http_from).path |