db.py 文件源码

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

项目:server 作者: viur-framework 项目源码 文件源码
def __setitem__(self, name, value):
        """
            Implements the [] operator. Used to set property value(s).

            :param name: Name of the property to set.
            :type name: str
            :param value: Any value to set tot the property.

            :raises: :exc:`BadPropertyError` if the property name is the \
            empty string or not a string.
            :raises: :exc:`BadValueError` if the value is not a supported type.
        """
        if isinstance(value,list) or isinstance(value,tuple):
            # We cant store an empty list, so we catch any attempts
            # and store None. As "does not exists" queries aren't
            # possible anyway, this makes no difference
            if len( value ) == 0:
                value = None
        super( Entity, self ).__setitem__( name, value )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号