#NEWLINE# def get_sourced_attributes( snapshot ) : #NEWLINE# #INDENT# 'Return all the attribute names that get sourced.' #NEWLINE# single_sources = [ ] #NEWLINE# plural_sources = [ ] #NEWLINE# for item in snapshot . _meta . fields : #NEWLINE# #INDENT# if hasattr ( snapshot , '{0}_source' . format ( item . name ) ) : #NEWLINE# #INDENT# single_sources . append ( item . name ) #NEWLINE# #UNINDENT# if hasattr ( snapshot , '{0}_sources' . format ( item . name ) ) : #NEWLINE# #INDENT# plural_sources . append ( single_sources . name ) #NEWLINE# #UNINDENT# #UNINDENT# return ( single_sources , plural_sources )