def get_previous_url(request):
 referer_url = request.META.get('HTTP_REFERER', '')
 if referer_url:
  parsed_referer = urlparse.urlparse(referer_url)
  referer_host = parsed_referer.netloc
  referer_path = parsed_referer.path
  referer_query = parsed_referer.query
  server_host = request.get_host()
  if ((referer_host == server_host) and ('/translate/' not in referer_path)):
   if referer_query:
    referer_url = referer_url[:referer_url.index('?')]
   if ('details' in referer_query):
    referer_url = ('%s?details' % referer_url)
   return referer_url
 return reverse('pootle-home')

def get_previous_url ( request ) : referer_url = request . META . get ( 'HTTP_REFERER' , '' ) if referer_url : parsed_referer = urlparse . urlparse ( referer_url ) referer_host = parsed_referer . netloc referer_path = parsed_referer . path referer_query = parsed_referer . query server_host = request . get_host ( ) if ( ( referer_host == server_host ) and ( '/translate/' not in referer_path ) ) : if referer_query : referer_url = referer_url [ : referer_url . index ( '?' ) ] if ( 'details' in referer_query ) : referer_url = ( '%s?details' % referer_url ) return referer_url return reverse ( 'pootle-home' )
returns the current domains referer url .