behaviors.py 文件源码

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

项目:lagendacommun 作者: ecreall 项目源码 文件源码
def start(self, context, request, appstruct, **kw):
        artists, new_artists = extract_artists(
            appstruct.pop('artists', []), request)
        directors, new_directors = extract_artists(
            appstruct.pop('directors', []),
            request, is_directors=True)
        appstruct.pop('artists_ids')
        appstruct.pop('directors_ids')
        if appstruct.get('picture', None) is not None and \
            OBJECT_DATA in appstruct['picture']:
            appstruct['picture'] = appstruct['picture'][OBJECT_DATA]
            if not getattr(appstruct['picture'], '__name__', None):
                appstruct['picture'].__name__ = 'picture'

        context.set_metadata(appstruct)
        context.set_data(appstruct)
        context.setproperty('artists', artists)
        context.setproperty('directors', directors)
        context.modified_at = datetime.datetime.now(tz=pytz.UTC)
        context.reindex()
        objects = [context]
        objects.extend(new_artists)
        objects.extend(new_directors)
        request.registry.notify(ActivityExecuted(self, objects, get_current()))
        return {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号