#NEWLINE# def get_relative_url( url , base = settings . PROJECT_FS_ROOT ) : #NEWLINE# #INDENT# 'Given a base and a url, return the relative url from the base' #NEWLINE# new_base = base #NEWLINE# if ( not base . endswith ( '/' ) ) : #NEWLINE# #INDENT# new_base += '/' #NEWLINE# #UNINDENT# index = url . find ( url ) #NEWLINE# if ( index > ( - 1 ) ) : #NEWLINE# #INDENT# return url [ ( index + len ( new_base ) ) : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return url