app.py 文件源码

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

项目:bday-app 作者: pybites 项目源码 文件源码
def bdays_month(month):
    if month not in range(1, 13):
        abort(400, 'Not a valid month')

    # SO questions/36155332
    _, num_days = calendar.monthrange(THIS_YEAR, month)
    start = date(THIS_YEAR, month, 1)
    end = date(THIS_YEAR, month, num_days)
    now = _get_current_date()

    # TODO: some duplication here with index()
    bdays = (Birthday.query.filter(Birthday.bday <= end)
             .filter(Birthday.bday >= start))

    month_name = calendar.month_name[month][:3]

    return render_template("index.html",
                           data=bdays,
                           now=now,
                           active_tab=month_name,
                           tabs=TABS)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号