#NEWLINE# def resolve_url_path( self , url_path , include_invisible = False , include_assets = True , alt_fallback = True ) : #NEWLINE# #INDENT# 'Given a URL path this will find the correct record which also\n        might be an attachment.  If a record cannot be found or is unexposed\n        the return value will be `None`.\n        ' #NEWLINE# pieces = clean_path = cleanup_path ( url_path ) . strip ( '/' ) #NEWLINE# ( alt , clean_path ) = _split_alt_from_url ( self . db . config , clean_path ) #NEWLINE# if ( clean_path is not None ) : #NEWLINE# #INDENT# if ( not alt ) : #NEWLINE# #INDENT# if alt_fallback : #NEWLINE# #INDENT# alt = ( self . db . config . primary_alternative or PRIMARY_ALT ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# alt = PRIMARY_ALT #NEWLINE# #UNINDENT# #UNINDENT# node = self . get_root ( alt = alt ) #NEWLINE# if ( node is None ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Tree root could not be found.' ) #NEWLINE# #UNINDENT# pieces = clean_path . split ( '/' ) #NEWLINE# if ( pieces == [ '' ] ) : #NEWLINE# #INDENT# pieces = [ ] #NEWLINE# #UNINDENT# rv = node . resolve_url_path ( pieces ) #NEWLINE# if ( ( rv is not None ) and ( pieces or rv . is_visible ) ) : #NEWLINE# #INDENT# return rv #NEWLINE# #UNINDENT# #UNINDENT# if include_assets : #NEWLINE# #INDENT# return self . asset_root . resolve_url_path ( pieces )