#NEWLINE# def url( parser , token ) : #NEWLINE# #INDENT# bits = token . split_contents ( ) #NEWLINE# if ( len ( bits ) < 2 ) : #NEWLINE# #INDENT# raise TemplateSyntaxError ( ( "'%s' takes at least one argument (path to a view)" % bits [ 0 ] ) ) #NEWLINE# #UNINDENT# viewname = bits [ 1 ] #NEWLINE# args = [ ] #NEWLINE# kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# asvar = None #NEWLINE# bits = bits [ 2 : ] #NEWLINE# if ( ( len ( bits ) >= 2 ) and ( bits [ ( - 2 ) ] == 'as' ) ) : #NEWLINE# #INDENT# asvar = bits [ ( - 1 ) ] #NEWLINE# bits = bits [ : ( - 2 ) ] #NEWLINE# #UNINDENT# if ( bits and ( ',' in bits [ 0 ] ) ) : #NEWLINE# #INDENT# check_old_format = True #NEWLINE# for bit in bits [ 1 : ( - 1 ) ] : #NEWLINE# #INDENT# if ( ',' not in bit ) : #NEWLINE# #INDENT# check_old_format = False #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# check_old_format = False #NEWLINE# #UNINDENT# if check_old_format : #NEWLINE# #INDENT# match = kwarg_re . match ( bits [ 0 ] ) #NEWLINE# if match : #NEWLINE# #INDENT# value = match . groups ( ) [ 1 ] #NEWLINE# try : #NEWLINE# #INDENT# parser . compile_filter ( value ) #NEWLINE# #UNINDENT# except TemplateSyntaxError : #NEWLINE# #INDENT# bits = '' . join ( bits ) . split ( ',' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if len ( bits ) : #NEWLINE# #INDENT# for bit in bits : #NEWLINE# #INDENT# match = kwarg_re . match ( bit ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# raise TemplateSyntaxError ( 'Malformed arguments to url tag' ) #NEWLINE# #UNINDENT# ( name , value ) = match . groups ( ) #NEWLINE# if name : #NEWLINE# #INDENT# kwargs [ name ] = parser . compile_filter ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args . append ( parser . compile_filter ( value ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# viewname = ThemeManager . getThemeStaticUrl ( viewname , args ) #NEWLINE# return URLNode ( viewname , args , kwargs , asvar )