Esempio n. 1
0
 def getReviewMonographs(self):
     pc = getToolByName(self.context, 'portal_catalog')
     langinfo = _languagelist.copy()
     langinfo[''] = { 'name':   'International',
                      'native': 'int'}
     query = dict(portal_type=["Review Monograph", "Review Journal"],
         review_state="published",
         sort_on='effective',
         sort_order='reverse', b_size=5)
     resultset = list()
     for lang in REVIEW_LANGUAGES:
         q = query.copy()
         if lang:
             q['languageReview'] = [lang]
         else:
             q['languageReview'] = list(
                 set(langinfo.keys()).difference(set(REVIEW_LANGUAGES)))
         res = pc(q)
         resultset.append(
             dict(
                 language=lang or 'int',
                 langname=langinfo[lang]['native'],
                 results=[dict(authors=self.format_authors(x),
                                 url=x.getURL(),
                                 title=x.getObject().punctuated_title_and_subtitle,
                                 date=self.format_effective_date(x['EffectiveDate'])) for x in res[:5]],
                 query_str=make_query(q))
             )
         # print "getReviewMonographs", lang, len(res)
     return resultset
Esempio n. 2
0
 def _getRmByLanguage(self, lang):
     pc = getToolByName(self.context, 'portal_catalog')
     langinfo = _languagelist.copy()
     langinfo[''] = { 'name':   'International',
                      'native': 'int'}
     resultset = list()
     query = self.review_base_query
     q = query.copy()
     if lang:
         q['languageReview'] = [lang]
     else:
         q['languageReview'] = list(
             set(langinfo.keys()).difference(set(self.review_languages)))
     res = pc(q)
     for part in range(6 / len(self.review_languages)):
         resultset.append(
             dict(
                 language=lang or 'int',
                 part=part,
                 langname=langinfo[lang]['native'],
                 results=[dict(authors=self.format_authors(x),
                                 path=x.getPath(),
                                 title=x.getObject().punctuated_title_and_subtitle,
                                 date=self.format_effective_date(x['EffectiveDate'])) for x in res[part*5:part*5+4]],
                 query_str=make_query(q))
             )
     # print "getReviewMonographs", lang, len(res)
     return resultset
Esempio n. 3
0
    def getLanguageListing(self, combined=False):
        """Return a sequence of language code and language name tuples."""
        languages = _languagelist.copy()
        if combined:
            languages.update(_combinedlanguagelist.copy())

        available = self.getAvailableLanguages(combined=combined)
        languages = {k: v for k, v in languages.items() if k in available}

        return [(code, languages[code][u"name"]) for code in languages]
Esempio n. 4
0
    def getLanguages(self, combined=False):
        """Return a sequence of Language objects for available languages."""
        languages = _languagelist.copy()
        if combined:
            languages.update(_combinedlanguagelist.copy())

        available = self.getAvailableLanguages(combined=combined)
        languages = {k: v for k, v in languages.items() if k in available}

        return languages
Esempio n. 5
0
    def getLanguageListing(self, combined=False):
        """Return a sequence of language code and language name tuples.
        """
        languages = _languagelist.copy()
        if combined:
            languages.update(_combinedlanguagelist.copy())

        available = self.getAvailableLanguages(combined=combined)
        languages = {k: v for k, v in languages.items() if k in available}

        return [(code, languages[code][u'name']) for code in languages]
Esempio n. 6
0
    def getLanguages(self, combined=False):
        """Return a sequence of Language objects for available languages.
        """
        languages = _languagelist.copy()
        if combined:
            languages.update(_combinedlanguagelist.copy())

        available = self.getAvailableLanguages(combined=combined)
        languages = {k: v for k, v in languages.items() if k in available}

        return languages
Esempio n. 7
0
 def getLanguageListing(self, combined=False):
     """Return a sequence of language code and language name tuples."""
     languages = _languagelist.copy()
     if combined:
         languages.update(_combinedlanguagelist.copy())
     return [(code, languages[code][u'name']) for code in languages]
Esempio n. 8
0
 def getLanguages(self, combined=False):
     """Return a sequence of Language objects for available languages."""
     languages = _languagelist.copy()
     if combined:
         languages.update(_combinedlanguagelist.copy())
     return languages
Esempio n. 9
0
 def getLanguageListing(self, combined=False):
     """Return a sequence of language code and language name tuples."""
     languages = _languagelist.copy()
     if combined:
         languages.update(_combinedlanguagelist.copy())
     return [(code, languages[code][u'name']) for code in languages]
Esempio n. 10
0
 def getLanguages(self, combined=False):
     """Return a sequence of Language objects for available languages."""
     languages = _languagelist.copy()
     if combined:
         languages.update(_combinedlanguagelist.copy())
     return languages