本文整理匯總了Python中djangodav.views.DavView.propfind方法的典型用法代碼示例。如果您正苦於以下問題:Python DavView.propfind方法的具體用法?Python DavView.propfind怎麽用?Python DavView.propfind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類djangodav.views.DavView
的用法示例。
在下文中一共展示了DavView.propfind方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_propfind_all_names
# 需要導入模塊: from djangodav.views import DavView [as 別名]
# 或者: from djangodav.views.DavView import propfind [as 別名]
def test_propfind_all_names(self):
self.sub_object.get_descendants.return_value += [self.sub_object]
request = Mock(META={})
path = 'collection/sub_object'
v = DavView(base_url='/base/', path=path, request=request, acl_class=FullAcl, xml_pretty_print=True)
v.__dict__['resource'] = self.sub_object
resp = v.propfind(request, path,
etree.XPathDocumentEvaluator(ElementTree(
D.propfind(
D.propname()
)
), namespaces=WEBDAV_NSMAP)
)
self.assertEqual(resp.status_code, 207)
self.assertEqual(resp.content,
etree.tostring(D.multistatus(
D.response(
D.href('/base/collection/sub_object'),
D.propstat(
D.prop(
D.getcontentlength(),
D.creationdate(),
D.getlastmodified(),
D.resourcetype(),
D.displayname(),
),
D.status("HTTP/1.1 200 OK")
)
),
), pretty_print=True, xml_declaration=True, encoding='utf-8')
)
示例2: test_propfind_listing
# 需要導入模塊: from djangodav.views import DavView [as 別名]
# 或者: from djangodav.views.DavView import propfind [as 別名]
def test_propfind_listing(self):
self.top_collection.get_descendants.return_value += [self.top_collection]
request = Mock(META={})
path = '/collection/'
v = DavView(base_url='/base/', path=path, request=request, acl_class=FullAcl, xml_pretty_print=True)
v.__dict__['resource'] = self.top_collection
resp = v.propfind(request, path, None)
self.assertEqual(resp.status_code, 207)
self.assertEqual(resp.content,
etree.tostring(D.multistatus(
D.response(
D.href('/base/collection/sub_object'),
D.propstat(
D.prop(
D.getcontentlength("42"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(),
D.displayname("sub_object"),
),
D.status("HTTP/1.1 200 OK")
)
),
D.response(
D.href('/base/collection/sub_colection/'),
D.propstat(
D.prop(
D.getcontentlength("0"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(D.collection()),
D.displayname("sub_colection"),
),
D.status("HTTP/1.1 200 OK")
)
),
D.response(
D.href('/base/collection/'),
D.propstat(
D.prop(
D.getcontentlength("0"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(D.collection()),
D.displayname("collection"),
),
D.status("HTTP/1.1 200 OK")
)
),
), pretty_print=True, xml_declaration=True, encoding='utf-8')
)