#NEWLINE# def generate_minimized( self , kargs ) : #NEWLINE# #INDENT# 'Generate a minimized version of the URL' #NEWLINE# routelist = self . routebackwards #NEWLINE# urllist = [ ] #NEWLINE# gaps = False #NEWLINE# for part in routelist : #NEWLINE# #INDENT# if ( isinstance ( part , dict ) and ( part [ 'type' ] in ( ':' , '.' ) ) ) : #NEWLINE# #INDENT# arg = part [ 'name' ] #NEWLINE# has_arg = ( arg in kargs ) #NEWLINE# has_default = ( arg in self . defaults ) #NEWLINE# if ( has_default and ( not has_arg ) and ( not gaps ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( ( has_default and has_arg ) and ( self . make_unicode ( kargs [ arg ] ) == self . make_unicode ( self . defaults [ arg ] ) ) and ( not gaps ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( has_arg and ( kargs [ arg ] is None ) and has_default and ( not gaps ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if has_arg : #NEWLINE# #INDENT# val = kargs [ arg ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( has_default and ( self . defaults [ arg ] is not None ) ) : #NEWLINE# #INDENT# val = self . defaults [ arg ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( part [ 'type' ] == '.' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# val = as_unicode ( val , self . encoding ) #NEWLINE# urllist . append ( url_quote ( val , self . encoding ) ) #NEWLINE# if ( part [ 'type' ] == '.' ) : #NEWLINE# #INDENT# urllist . append ( '.' ) #NEWLINE# #UNINDENT# if has_arg : #NEWLINE# #INDENT# del kargs [ arg ] #NEWLINE# #UNINDENT# gaps = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( part , dict ) and ( part [ 'type' ] == '*' ) ) : #NEWLINE# #INDENT# arg = part [ 'name' ] #NEWLINE# kar = kargs . get ( arg ) #NEWLINE# if ( kar is not None ) : #NEWLINE# #INDENT# urllist . append ( url_quote ( kar , self . encoding ) ) #NEWLINE# gaps = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( part and ( part [ ( - 1 ) ] in self . done_chars ) ) : #NEWLINE# #INDENT# if ( ( not gaps ) and ( part in self . done_chars ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not gaps ) : #NEWLINE# #INDENT# urllist . append ( part [ : ( - 1 ) ] ) #NEWLINE# gaps = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# gaps = True #NEWLINE# urllist . append ( part ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# gaps = True #NEWLINE# urllist . append ( part ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# urllist . reverse ( ) #NEWLINE# url = '' . join ( urllist ) #NEWLINE# return url