#NEWLINE# @ property #NEWLINE# def to_class( self ) : #NEWLINE# #INDENT# if self . _to_class : #NEWLINE# #INDENT# return self . _to_class #NEWLINE# #UNINDENT# if ( not isinstance ( self . to , six . string_types ) ) : #NEWLINE# #INDENT# self . _to_class = self . to #NEWLINE# return self . _to_class #NEWLINE# #UNINDENT# if ( self . to == 'self' ) : #NEWLINE# #INDENT# self . _to_class = self . _resource #NEWLINE# return self . _to_class #NEWLINE# #UNINDENT# if ( '.' in self . to ) : #NEWLINE# #INDENT# module_bits = self . to . split ( '.' ) #NEWLINE# ( module_path , class_name ) = ( '.' . join ( module_bits [ : ( - 1 ) ] ) , module_bits [ ( - 1 ) ] ) #NEWLINE# module = importlib . import_module ( module_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ImportError ( ( "Tastypie requires a Python-style path (<module.module.Class>) to lazy load related resources. Only given '%s'." % self . to ) ) #NEWLINE# #UNINDENT# self . _to_class = getattr ( module , class_name , None ) #NEWLINE# if ( self . _to_class is None ) : #NEWLINE# #INDENT# raise ImportError ( ( "Module '%s' does not appear to have a class called '%s'." % ( module_path , class_name ) ) ) #NEWLINE# #UNINDENT# return self . _to_class