views.py 文件源码

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

项目:isthislegit 作者: duo-labs 项目源码 文件源码
def edit_template(template_id):
    '''
    Edits an existing template.

    Args:
    template_id - int - The ID of the template to edit
    '''
    template = Template.get_by_id(template_id)
    if not template or template.owner_domain != g.domain:
        abort(404)

    form = TemplateForm(request.form, domain=g.domain, template_id=template_id)
    if form.validate_on_submit():
        template.name = form.name.data
        template.text = form.text.data
        template.subject = form.subject.data
        template.sender = g.user.email()
        template.put()
        return jsonify(template.to_dict())
    return json_error(400, list_errors(form), {})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号