utils.py 文件源码

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

项目:PyWebDAV3 作者: andrewleech 项目源码 文件源码
def make_xmlresponse(result):
    """ construct a response from a dict of uri:error_code elements """
    doc = minidom.getDOMImplementation().createDocument(None, "multistatus", None)
    doc.documentElement.setAttribute("xmlns:D","DAV:")
    doc.documentElement.tagName = "D:multistatus"

    for el,ec in result.items():
        re=doc.createElementNS("DAV:","response")
        hr=doc.createElementNS("DAV:","href")
        st=doc.createElementNS("DAV:","status")
        huri=doc.createTextNode(quote_uri(el))
        t=doc.createTextNode(gen_estring(ec))
        st.appendChild(t)
        hr.appendChild(huri)
        re.appendChild(hr)
        re.appendChild(st)
        doc.documentElement.appendChild(re)

    return doc.toxml(encoding="utf-8")

# taken from App.Common
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号