#NEWLINE# def urlquote( link = None , get = None ) : #NEWLINE# #INDENT# "\n    This method does both: urlquote() and urlencode()\n\n    urlqoute(): Quote special characters in 'link'\n\n    urlencode(): Map dictionary to query string key=value&...\n\n    HTML escaping is not done.\n\n    Example:\n\n    urlquote('/wiki/Python_(programming_language)')\n        --> '/wiki/Python_%28programming_language%29'\n    urlquote('/mypath/', {'key': 'value'})\n        --> '/mypath/?key=value'\n    urlquote('/mypath/', {'key': ['value1', 'value2']})\n        --> '/mypath/?key=value1&key=value2'\n    urlquote({'key': ['value1', 'value2']})\n        --> 'key=value1&key=value2'\n    " #NEWLINE# if ( get is None ) : #NEWLINE# #INDENT# get = [ ] #NEWLINE# #UNINDENT# assert ( link or get ) #NEWLINE# if isinstance ( link , dict ) : #NEWLINE# #INDENT# assert ( not get ) , get #NEWLINE# get = link #NEWLINE# link = '' #NEWLINE# #UNINDENT# assert isinstance ( get , dict ) , ( 'wrong type "%s", dict required' % type ( get ) ) #NEWLINE# if get : #NEWLINE# #INDENT# if isinstance ( get , MultiValueDict ) : #NEWLINE# #INDENT# get = get . lists ( ) #NEWLINE# #UNINDENT# if link : #NEWLINE# #INDENT# link = ( '%s?' % django_urlquote ( link ) ) #NEWLINE# #UNINDENT# return ( '%s%s' % ( link , django_urlencode ( link , doseq = True ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return django_urlquote ( link )