__init__.py 文件源码

python
阅读 145 收藏 0 点赞 0 评论 0

项目:lagendacommun 作者: ecreall 项目源码 文件源码
def evolve_services(root, registry):
    from lac.views.filter import find_entities
    from lac.content.interface import IService
    from lac.content.site_folder import SiteFolder

    contents = find_entities(interfaces=[IService])
    len_entities = str(len(contents))
    for index, service in enumerate(contents):
        if service.definition.service_id == 'moderation':
            if not isinstance(getattr(service, 'perimeter', None), SiteFolder):
                subscription = service.subscription
                subscription['subscription_type'] = 'per_unit'
                service.subscription = PersistentDict(subscription)
                service.reindex()

        if index % 1000 == 0:
            log.info("**** Commit ****")
            transaction.commit()

        log.info(str(index) + "/" + len_entities)

    log.info('Services evolved.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号