本文整理汇总了Python中XMLHelpers.addOrganization方法的典型用法代码示例。如果您正苦于以下问题:Python XMLHelpers.addOrganization方法的具体用法?Python XMLHelpers.addOrganization怎么用?Python XMLHelpers.addOrganization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLHelpers
的用法示例。
在下文中一共展示了XMLHelpers.addOrganization方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_addorg3
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import addOrganization [as 别名]
def test_addorg3(self):
xml_file = open("test/test_add3.xml", 'rb')
tree = ElementTree.parse(xml_file)
test_list = db.GqlQuery("SELECT * FROM Crisis")
orgs = tree.findall(".//organization")
for org in orgs:
if (org.find('.//info')):
XMLHelpers.addOrganization(org)
test_list = db.GqlQuery("SELECT * from Organization")
self.assertEqual(test_list.count(),0)
db.delete(db.Query())
示例2: post
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import addOrganization [as 别名]
def post(self):
#logging.info('***** starting task')
#crises = self.request.get('crises')
payload = zloads(self.request.body)
if payload[0] == 'crisis':
XMLHelpers.addCrisis(payload[1])
if payload[0] == 'person':
XMLHelpers.addPerson(payload[1])
if payload[0] == 'org':
XMLHelpers.addOrganization(payload[1])
示例3: test_addorg3
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import addOrganization [as 别名]
def test_addorg3(self):
xml_file = open("test/test_add3.xml", 'rb')
tree = ElementTree.parse(xml_file)
test_list = []
orgs = tree.findall(".//organization")
for org in orgs:
if (org.find('.//info')):
test_list = XMLHelpers.addOrganization(org)
self.assertEqual(len(test_list),0)
test_list[:] = []