本文整理汇总了Python中opengever.ogds.base.actor.Actor.contact方法的典型用法代码示例。如果您正苦于以下问题:Python Actor.contact方法的具体用法?Python Actor.contact怎么用?Python Actor.contact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengever.ogds.base.actor.Actor
的用法示例。
在下文中一共展示了Actor.contact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getTerm
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import contact [as 别名]
def getTerm(self, value, brain=None):
if not ActorLookup(value).is_contact():
raise ValueError('Value is not a contact token')
catalog = api.portal.get_tool('portal_catalog')
brain = catalog.unrestrictedSearchResults(
portal_type=CONTACT_TYPE,
contactid=value)[0]
actor = Actor.contact(brain.contactid, contact=brain)
token = value
title = actor.get_label()
return SimpleTerm(value, token, title)
示例2: key_value_provider
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import contact [as 别名]
def key_value_provider(self):
# Reset hidden_terms every time cache key changed
self.hidden_terms = []
items, hidden_terms = self._get_users()
# copy lists to prevent cache modification
items = items[:]
self.hidden_terms = hidden_terms[:]
for contact in contact_service().all_contact_brains():
actor = Actor.contact(contact.contactid, contact=contact)
items.append((contact.contactid, actor.get_label()))
return items