コード例 #1
0
def get_current_standout_journalism():
    """Return content currently marked as standout journalism.

    :returns: a list of objects marked as standout journalism
    :rtype: list of content type instances
    :raises AssertionError: if there are more than 7 items
    """
    record = 'collective.googlenews.interfaces.GoogleNewsSettings.portal_types'
    portal_types = api.portal.get_registry_record(record)
    catalog = api.portal.get_tool('portal_catalog')
    query = dict(
        portal_type=portal_types,
        standout_journalism=True,
        effective=dict(query=DateTime() - 7, range='min'),
        review_state='published',
    )
    results = catalog(**query)
    msg = 'There are currently {0} items marked as standout'
    logger.info(msg.format(len(results)))
    logger.info(repr([b.id for b in results]))
    return [b.getObject() for b in results]
コード例 #2
0
def apply_patched_logo(scope, original, replacement):
    setattr(scope, '_{0}'.format(original), getattr(scope, original, None))
    setattr(scope, original, replacement())
    logger.info(
        'Patched FolderFeed to return a Google News compliant logo, if available')
コード例 #3
0
def update_portal_catalog(setup_tool):
    """Add catalog indexes and metadata for Google News behavior fields."""
    profile = 'profile-{0}:default'.format(PROJECTNAME)
    setup_tool.runImportStepFromProfile(profile, 'catalog')
    add_catalog_indexes(setup_tool)
    logger.info('Portal catalog successfully updated')
コード例 #4
0
def add_editor_picks_tab(setup_tool):
    """Add support for Google News Editors' Picks feeds."""
    profile = 'profile-{0}:default'.format(PROJECTNAME)
    setup_tool.runImportStepFromProfile(profile, 'plone.app.registry')
    logger.info("Google News Editors' Picks feeds support successfully added")
コード例 #5
0
def apply_patched_logo(scope, original, replacement):
    setattr(scope, '_{0}'.format(original), getattr(scope, original, None))
    setattr(scope, original, replacement())
    logger.info(
        'Patched FolderFeed to return a Google News compliant logo, if available'
    )