def search(self, REQUEST):
    """ folder search """
    results = []
    query = REQUEST.get('query', '')
    path = REQUEST.get('path', '')
    meta_type = self.get_meta_types()
    if query:
        results = []
        results.extend(self.query_objects_ex(meta_type, query, self.gl_get_selected_language(), path=path, approved=1))
        results = self.utEliminateDuplicatesByURL(results)
        results = [item for item in results if item.can_be_seen()]

    paginator = DiggPaginator(results, 10, body=5, padding=2, orphans=5)   #Show 10 documents per page

    # Make sure page request is an int. If not, deliver first page.
    try:
        page = int(REQUEST.get('page', '1'))
    except ValueError:
        page = 1

    # If page request (9999) is out of range, deliver last page of results.
    try:
        results = paginator.page(page)
    except (EmptyPage, InvalidPage):
        results = paginator.page(paginator.num_pages)

    folder = self.restrictedTraverse(path)

    return _search.__of__(folder)(REQUEST, results=results)
Exemple #2
0
def search(self, REQUEST):
    """ folder search """
    results = []
    query = REQUEST.get('query', '')
    path = REQUEST.get('path', '')
    meta_type = self.get_meta_types()
    if query:
        results = []
        results.extend(
            self.query_objects_ex(meta_type,
                                  query,
                                  self.gl_get_selected_language(),
                                  path=path,
                                  approved=1))
        results = self.utEliminateDuplicatesByURL(results)
        results = [item for item in results if item.can_be_seen()]

    paginator = DiggPaginator(results, 10, body=5, padding=2,
                              orphans=5)  #Show 10 documents per page

    # Make sure page request is an int. If not, deliver first page.
    try:
        page = int(REQUEST.get('page', '1'))
    except ValueError:
        page = 1

    # If page request (9999) is out of range, deliver last page of results.
    try:
        results = paginator.page(page)
    except (EmptyPage, InvalidPage):
        results = paginator.page(paginator.num_pages)

    folder = self.restrictedTraverse(path)

    return _search.__of__(folder)(REQUEST, results=results)
Exemple #3
0
def terms(request):
    c = get_context(request, css_class='body-glossary', title=_(u'¿Qué significa?'))

    c['query'] = request.GET.get('q', '')
    c['query_string'] = "q=%s&" % (c['query'])
    c['page'] = request.GET.get('page', 1)

    results = Paginator(list(GlossaryTerm.objects.search(c['query'], c['LANGUAGE_CODE'])), PAGE_LENGTH, body=6, padding=2)
    c['terms'] = results.page(c['page'])

    return render_to_response('terms/index.html', c)
Exemple #4
0
def terms(request):
    c = get_context(request,
                    css_class='body-glossary',
                    title=_(u'¿Qué significa?'))

    c['query'] = request.GET.get('q', '')
    c['query_string'] = "q=%s&" % (c['query'])
    c['page'] = request.GET.get('page', 1)

    results = Paginator(list(
        GlossaryTerm.objects.search(c['query'], c['LANGUAGE_CODE'])),
                        PAGE_LENGTH,
                        body=6,
                        padding=2)
    c['terms'] = results.page(c['page'])

    return render_response('terms/index.html', c)
Exemple #5
0
    def itemsPaginator(self, REQUEST):
        """ """
        items_list = list(self.admin_get_subscriptions())
        paginator = DiggPaginator(items_list, 20, body=5, padding=2, orphans=5)   #Show 10 documents per page

        # Make sure page request is an int. If not, deliver first page.
        try:
            page = int(REQUEST.get('page', '1'))
        except ValueError:
            page = 1

        # If page request (9999) is out of range, deliver last page of results.
        try:
            items = paginator.page(page)
        except (EmptyPage, InvalidPage):
            items = paginator.page(paginator.num_pages)

        return items
    def itemsPaginator(self, REQUEST):
        """ """
        category = REQUEST.get('category', self.getDefaultCategory())
        category_item = REQUEST.get('category_item', '1')

        items_list = self.getInfosByCategoryId(category, category_item)
        paginator = DiggPaginator(items_list, 20, body=5, padding=2, orphans=5)   #Show 10 documents per page

        # Make sure page request is an int. If not, deliver first page.
        try:
            page = int(REQUEST.get('page', '1'))
        except ValueError:
            page = 1

        # If page request (9999) is out of range, deliver last page of results.
        try:
            items = paginator.page(page)
        except (EmptyPage, InvalidPage):
            items = paginator.page(paginator.num_pages)

        return items
Exemple #7
0
    def itemsPaginator(self, REQUEST):
        """ """
        category = REQUEST.get('category', self.getDefaultCategory())
        category_item = REQUEST.get('category_item', '1')

        items_list = self.getInfosByCategoryId(category, category_item)
        paginator = DiggPaginator(items_list, 20, body=5, padding=2,
                                  orphans=5)  #Show 10 documents per page

        # Make sure page request is an int. If not, deliver first page.
        try:
            page = int(REQUEST.get('page', '1'))
        except ValueError:
            page = 1

        # If page request (9999) is out of range, deliver last page of results.
        try:
            items = paginator.page(page)
        except (EmptyPage, InvalidPage):
            items = paginator.page(paginator.num_pages)

        return items