def extract_url_path_and_query(full_url=None, no_query=False):
 if (full_url is None):
  full_url = request.url
 split = urlsplit(full_url)
 result = (split.path or '/')
 if ((not no_query) and split.query):
  result += ('?' + split.query)
 return result

def extract_url_path_and_query ( full_url = None , no_query = False ) : if ( full_url is None ) : full_url = request . url split = urlsplit ( full_url ) result = ( split . path or '/' ) if ( ( not no_query ) and split . query ) : result += ( '?' + split . query ) return result
convert URL to /aaa/p .