#NEWLINE# def execute( self ) : #NEWLINE# #INDENT# 'This will actually call the :meth:`get_data_iterator` and run the\n        database query.\n\n        Automatically called when either :attr:`data_iterator`\n        or :attr:`sliced_data_iterator` is accesed.\n\n        ' #NEWLINE# try : #NEWLINE# #INDENT# self . _data_iterator = self . get_data_iterator ( ) #NEWLINE# #UNINDENT# except Warning as e : #NEWLINE# #INDENT# self . no_data_text = six . text_type ( e ) #NEWLINE# self . _data_iterator = [ ] #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# if ( not settings . SITE . catch_layout_exceptions ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# self . no_data_text = six . text_type ( e ) #NEWLINE# w = WARNINGS_LOGGED . get ( six . text_type ( e ) ) #NEWLINE# if ( w is None ) : #NEWLINE# #INDENT# WARNINGS_LOGGED [ six . text_type ( e ) ] = True #NEWLINE# raise #NEWLINE# #UNINDENT# self . _data_iterator = [ ] #NEWLINE# #UNINDENT# if isinstance ( self . _data_iterator , GeneratorType ) : #NEWLINE# #INDENT# self . _data_iterator = tuple ( self . _data_iterator ) #NEWLINE# #UNINDENT# self . _sliced_data_iterator = self . _data_iterator #NEWLINE# if False : #NEWLINE# #INDENT# if ( self . offset is not None ) : #NEWLINE# #INDENT# assert ( self . limit is not None ) #NEWLINE# num = self . get_total_count ( ) #NEWLINE# max_pages = int ( old_div ( num , self . limit ) ) #NEWLINE# page = old_div ( self . offset , self . limit ) #NEWLINE# page = ( max_pages - page ) #NEWLINE# offset = ( self . limit * page ) #NEWLINE# self . _sliced_data_iterator = self . _sliced_data_iterator [ offset : ] #NEWLINE# self . _sliced_data_iterator = self . _sliced_data_iterator [ : self . limit ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . offset is not None ) : #NEWLINE# #INDENT# offset = self . offset #NEWLINE# if ( offset == ( - 1 ) ) : #NEWLINE# #INDENT# assert ( self . limit is not None ) #NEWLINE# num = self . get_total_count ( ) #NEWLINE# page_num = int ( old_div ( num , self . limit ) ) #NEWLINE# offset = ( self . limit * page_num ) #NEWLINE# #UNINDENT# self . _sliced_data_iterator = self . _sliced_data_iterator [ offset : ] #NEWLINE# #UNINDENT# if ( self . limit is not None ) : #NEWLINE# #INDENT# self . _sliced_data_iterator = self . _sliced_data_iterator [ : self . limit ]