behaviors.py 文件源码

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

项目:lagendacommun 作者: ecreall 项目源码 文件源码
def start(self, context, request, appstruct, **kw):
        user = get_current()
        artists, new_artists = extract_artists(
            appstruct.get('artists', []), request)
        context.setproperty('artists', artists)
        context.modified_at = datetime.datetime.now(tz=pytz.UTC)
        context.set_metadata(appstruct)
        if 'published' in context.state:
            not_published_artists = [a for a in context.artists
                                     if 'published' not in a.state]
            for artist in not_published_artists:
                publish_artist(artist, request, user)

        context.reindex()
        new_objects = new_artists
        new_objects.append(context)
        request.registry.notify(ActivityExecuted(self, new_objects, user))
        return {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号