__init__.py 文件源码

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

项目:flask-alcohol 作者: natfoster82 项目源码 文件源码
def _auto_update(self, mapper=None):
        cls = self.__class__
        if mapper is None:
            mapper = class_mapper(cls)
        for col in mapper.columns:
            # this order is the listed order except that hybrid properties go first
            api_info = cls._get_api_info(col.name)
            set_by = api_info['set_by']
            if set_by == 'json':
                if col.name in g.fields:
                    val = g.fields.get(col.name)
                    self._set_field_value(col.name, val)
            elif set_by == 'url':
                if col.name in request.view_args:
                    val = request.view_args.get(col.name)
                    self._set_field_value(col.name, val)
            elif set_by == 'server':
                # important not to let it try to set it from json
                # requires a @setter decorated function
                self._set_field_value(name=col.name, try_auto=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号