本文整理汇总了Python中corehq.apps.app_manager.xpath.XPath.select方法的典型用法代码示例。如果您正苦于以下问题:Python XPath.select方法的具体用法?Python XPath.select怎么用?Python XPath.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.app_manager.xpath.XPath
的用法示例。
在下文中一共展示了XPath.select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: owner_name
# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import select [as 别名]
def owner_name(owner_id):
groups = XPath(u"instance('groups')/groups/group")
group = groups.select("@id", owner_id)
return XPath.if_(
group.count().neq(0),
group.slash("name"),
XPath.if_(CommCareSession.userid.eq(owner_id), CommCareSession.username, XPath.string("")),
)
示例2: owner_name
# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import select [as 别名]
def owner_name(owner_id):
groups = XPath(u"instance('groups')/groups/group")
group = groups.select('@id', owner_id)
return XPath.if_(
group.count().not_equals(0),
group.slash('name'),
XPath.if_(
CommCareSession.userid.equals(owner_id),
CommCareSession.username,
XPath.string('')
)
)