studio.py 文件源码

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

项目:stalker_pyramid 作者: eoyilmaz 项目源码 文件源码
def studio_scheduling_mode(request):
    """Sets the system to "in schedule" mode or "normal" mode. When the system
    is "in schedule" mode (Studio.is_scheduling == True) it is not allowed to
    schedule the system again until the previous one is finishes.
    """
    logged_in_user = get_logged_in_user(request)

    # get the studio
    studio = Studio.query.first()

    mode = request.params.get('mode')
    logger.debug('schedule mode: %s' % mode)

    if not studio:
        transaction.abort()
        return Response("There is no Studio instance\n"
                        "Please create a studio first", 500)

    if mode:  # set the mode
        mode = bool(int(mode))

        studio.is_scheduling = mode
        studio.is_scheduling_by = logged_in_user
        studio.scheduling_started_at = local_to_utc(datetime.datetime.now())

        return Response(
            "Successfully, set the scheduling mode to: %s" % mode
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号