wsgiserver.py 文件源码

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

项目:gif-disco 作者: futurice 项目源码 文件源码
def add_new_gif(visible_gifs, gif):
    """Add new gif to visible gifs, this might push the oldest away
    from visible!
    """
    new_gif = {
        'id': gif['id'],
        'position': {'bottom': 40, 'left': 50},
        'height': gif['height'],
        'added': int(time.time())
    }

    if len(visible_gifs) >= settings['maxVisible']:
        oldest = visible_gifs.pop(0)
        logger.info('Popped oldest %s' % oldest['id'])
        # Take position from the oldest
        new_gif['position'] = oldest['position']
        new_gif['height'] = oldest['height']

    visible_gifs.append(new_gif)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号