def format_results(self, p_objects=[], skey='', rkey='', ps_start=''): """Return sorted events""" results = [] res_per_page = 10 try: ps_start = int(ps_start) except: ps_start = 0 try: rkey = int(rkey) except: rkey = 0 if skey == 'date': p_objects.sort(lambda x, y: cmp(y.bobobase_modification_time(), x.bobobase_modification_time())) results.extend(p_objects) else: l_objects = self.utSortObjsByLocaleAttr( p_objects, skey, rkey, self.gl_get_selected_language()) results.extend(l_objects) #batch related batch_obj = batch_utils(res_per_page, len(results), ps_start) if len(results) > 0: paging_informations = batch_obj.butGetPagingInformations() else: paging_informations = (-1, 0, 0, -1, -1, 0, res_per_page, [0]) return (paging_informations, (1, 1, results[paging_informations[0]:paging_informations[1]]))
def _page_result_admin(self, p_result, p_start): #Returns results with paging information l_paging_information = (0, 0, 0, -1, -1, 0, NUMBER_OF_RESULTS_PER_PAGE, [0]) try: p_start = abs(int(p_start)) except: p_start = 0 if len(p_result) > 0: l_paging_information = batch_utils(NUMBER_OF_RESULTS_PER_PAGE, len(p_result), p_start).butGetPagingInformations() if len(p_result) > 0: return (l_paging_information, self.get_archive_listing(p_result[l_paging_information[0]:l_paging_information[1]])) else: return (l_paging_information, self.get_archive_listing([]))
def _page_result(self, p_result, p_start): #Returns results with paging information l_paging_information = (0, 0, 0, -1, -1, 0, NUMBER_OF_RESULTS_PER_PAGE, [0]) try: p_start = abs(int(p_start)) except: p_start = 0 if len(p_result) > 0: l_paging_information = batch_utils(NUMBER_OF_RESULTS_PER_PAGE, len(p_result), p_start).butGetPagingInformations() if len(p_result) > 0: return (l_paging_information, self.utSplitSequence(p_result[l_paging_information[0]:l_paging_information[1]], NUMBER_OF_RESULTS_PER_LINE)) else: return (l_paging_information, self.utSplitSequence([], NUMBER_OF_RESULTS_PER_LINE))
def _page_result_admin(self, p_result, p_start): #Returns results with paging information l_paging_information = (0, 0, 0, -1, -1, 0, NUMBER_OF_RESULTS_PER_PAGE, [0]) try: p_start = abs(int(p_start)) except: p_start = 0 if len(p_result) > 0: l_paging_information = batch_utils( NUMBER_OF_RESULTS_PER_PAGE, len(p_result), p_start).butGetPagingInformations() if len(p_result) > 0: return ( l_paging_information, self.get_archive_listing( p_result[l_paging_information[0]:l_paging_information[1]])) else: return (l_paging_information, self.get_archive_listing([]))
def _page_result(self, p_result, p_start): #Returns results with paging information l_paging_information = (0, 0, 0, -1, -1, 0, NUMBER_OF_RESULTS_PER_PAGE, [0]) try: p_start = abs(int(p_start)) except: p_start = 0 if len(p_result) > 0: l_paging_information = batch_utils( NUMBER_OF_RESULTS_PER_PAGE, len(p_result), p_start).butGetPagingInformations() if len(p_result) > 0: return ( l_paging_information, self.utSplitSequence( p_result[l_paging_information[0]:l_paging_information[1]], NUMBER_OF_RESULTS_PER_LINE)) else: return (l_paging_information, self.utSplitSequence([], NUMBER_OF_RESULTS_PER_LINE))
def format_results(self, p_objects=[], skey='', rkey='', ps_start=''): """Return sorted events""" results = [] res_per_page = 10 try: ps_start = int(ps_start) except: ps_start = 0 try: rkey = int(rkey) except: rkey = 0 if skey == 'date': p_objects.sort(lambda x,y: cmp(y.bobobase_modification_time(), x.bobobase_modification_time())) results.extend(p_objects) else: l_objects = self.utSortObjsByLocaleAttr(p_objects, skey, rkey, self.gl_get_selected_language()) results.extend(l_objects) #batch related batch_obj = batch_utils(res_per_page, len(results), ps_start) if len(results) > 0: paging_informations = batch_obj.butGetPagingInformations() else: paging_informations = (-1, 0, 0, -1, -1, 0, res_per_page, [0]) return (paging_informations, (1, 1, results[paging_informations[0]:paging_informations[1]]))