app/soc/views/helper/requests.py
changeset 1631 25ec972b5aa2
parent 1381 2cfce3831fc6
child 1670 4d9bd851a5f5
equal deleted inserted replaced
1630:850c08c90345 1631:25ec972b5aa2
    49     value_idx = value_idx[0]
    49     value_idx = value_idx[0]
    50 
    50 
    51   try:
    51   try:
    52     # GET parameter 'param_name' should be an integer value index
    52     # GET parameter 'param_name' should be an integer value index
    53     value_idx = int(value_idx)
    53     value_idx = int(value_idx)
    54   except:
    54   except ValueError:
    55     # ignore bogus or missing parameter values, so return None (no message)
    55     # ignore bogus or missing parameter values, so return None (no message)
    56     return None
    56     return None
    57     
    57     
    58   if value_idx < 0:
    58   if value_idx < 0:
    59     # value index out of range, so return None (no value)
    59     # value index out of range, so return None (no value)
   117 
   117 
   118   if not http_from:
   118   if not http_from:
   119     # no HTTP referrer, so cannot possibly start with expected prefix
   119     # no HTTP referrer, so cannot possibly start with expected prefix
   120     return False
   120     return False
   121 
   121 
   122   http_host = 'http://%s/%s' %(os.environ['HTTP_HOST'], url_name)
   122   http_host = 'http://%s/%s' % (os.environ['HTTP_HOST'], url_name)
   123 
   123 
   124   if http_from.startswith(http_host):
   124   if http_from.startswith(http_host):
   125     return True
   125     return True
   126 
   126 
   127   from_path = urlparse.urlparse(http_from).path
   127   from_path = urlparse.urlparse(http_from).path