Пример #1
0
    def _getUltimoCurso(self, hash, limit=1, offset=0,
                                  d1=None, d2=None, qw=None,
                                  exportar=None, render=None,
                                  tags=[], corpo=None,
                                  sametree=None, samesite=None):
        """
            call _getListContent method portal
            to retrieve the content's tree came from the parameter hash.
            if the parameter corpo is True, more data will be retrieve from
            the content

            @hash: list of string of tree hash identification
            @limit: size of items to retrieve
            @offset: start index number of listing
            @d1: string that represent first date to start listing, '2010-01-20'
            @d2: string that represent the last date to listing, '2010-01-21'
            @qw: list of words that must have on listing items
            @exportar: True or False to indicate the url will be dinamic or static
            @render: True of False if the url must be complete or ssi include like
            @tags: list of strings to filter the content
            @corpo: True or False if must retrive corpo field

            >>> self._getUltimasNoticias(hash=['94169735419684109', '198413574648732'],
                                         corpo=1)
            {"res":[...], "qtde":10}
        """
        id_site_origin = getSiteByHost(self.id_site, self.request)
        if id_site_origin:
            id_site_origin = id_site_origin["id_site"]
            if id_site_origin == int(self.id_site):
                id_site_origin = None

        if type(hash) is not list:
            hash = [hash]

        items = self._getListContent(id_site=self.id_site,
                                      hash=hash,
                                      comentario=False,
                                      acesso=False,
                                      acesso24h=None,
                                      voto=False,
                                      keywords=qw,
                                      de=d1,
                                      ate=d2,
                                      tags=tags,
                                      limit=limit,
                                      offset=offset,
                                      render=render,
                                      sametree=sametree,
                                      samesite=samesite,
                                      id_site_origin=id_site_origin)
        itens = []
        idcs = []
        idcsd = {}
        items_ = [i for i in items["itens"] 
                                if idcs.append(str(i["id_conteudo"])) or 1]
        for i in items_:
            i['dados'] = self._getConteudoPublicado(id_conteudo=i["id_conteudo"])    

        return items_