本文整理汇总了Python中opengever.ogds.base.actor.Actor.user方法的典型用法代码示例。如果您正苦于以下问题:Python Actor.user方法的具体用法?Python Actor.user怎么用?Python Actor.user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengever.ogds.base.actor.Actor
的用法示例。
在下文中一共展示了Actor.user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: actor
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def actor(self):
"""Returns a formatted link to the actor that created this version.
"""
if self.version == 0:
# Always return document's original creator for initial version
return Actor.user(self._context.Creator()).get_link()
principal = self.sys_metadata['principal']
actor = Actor.user(principal)
return actor.get_link()
示例2: setUp
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def setUp(self):
super(TestResolveOGUIDView, self).setUp()
self.group = create(Builder('ogds_group')
.having(groupid='group', users=[self.user]))
self.user2 = create(Builder('ogds_user')
.in_group(self.group)
.having(userid='x.john.doe',
lastname='Doe',
firstname='John'))
self.actor1 = Actor.user(self.user.userid)
self.actor2 = Actor.user(self.user2.userid)
示例3: render_checked_out_link
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def render_checked_out_link(self):
manager = queryMultiAdapter(
(self.context, self.request), ICheckinCheckoutManager)
if manager.get_checked_out_by():
return Actor.user(manager.get_checked_out_by()).get_link()
return ''
示例4: display_name
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def display_name(userid):
if not isinstance(userid, unicode):
if userid is not None:
userid = userid.decode('utf-8')
else:
userid = ''
return Actor.user(userid).get_label(with_principal=False)
示例5: readable_ogds_user
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def readable_ogds_user(item, userid):
if not isinstance(userid, unicode):
if userid is not None:
userid = userid.decode('utf-8')
else:
userid = ''
return Actor.user(userid).get_label()
示例6: linked_user_helper
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def linked_user_helper(item, value):
"""Helper for linking the value with the user profile.
"""
userid = getattr(item, 'userid', None)
url = Actor.user(userid, user=item).get_profile_url()
if not url:
return value
return u'<a href="{}">{}</a>'.format(url, value)
示例7: update
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def update(self):
manager = queryMultiAdapter((self.context, self.request),
ICheckinCheckoutManager)
if not manager:
self.available = False
elif not manager.get_checked_out_by():
self.available = False
else:
self.available = True
self.checkout_by_link = Actor.user(
manager.get_checked_out_by()).get_link()
示例8: __call__
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def __call__(self):
self.group_id = self.context.REQUEST.get("group", None)
self.members = []
if not self.group_id:
return "no group id"
group = ogds_service().fetch_group(self.group_id)
self.active = group.active
actors = [Actor.user(user.userid) for user in group.users]
actors.sort(key=lambda actor: actor.get_label())
self.members = [each.get_link() for each in actors]
return self.template()
示例9: __call__
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def __call__(self):
self.group_id = self.context.REQUEST.get('group', None)
self.members = []
if not self.group_id:
return 'no group id'
group = ogds_service().fetch_group(self.group_id)
self.active = getattr(group, 'active', None)
actors = [Actor.user(user.userid)
for user in getattr(group, 'users', [])]
actors.sort(key=lambda actor: actor.get_label())
self.members = [each.get_link() for each in actors]
return self.template()
示例10: __call__
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def __call__(self):
self.team_id = self.context.REQUEST.get('team', None)
self.members = []
if not self.team_id:
raise BadRequest('no team id')
try:
team = Team.query.filter_by(team_id=self.team_id).one()
group = getattr(team, 'group', None)
self.group_id = getattr(group, 'groupid', None)
except NoResultFound:
self.group_id = None
if not self.group_id:
raise BadRequest('no group id')
self.active = getattr(group, 'active', None)
actors = [Actor.user(user.userid) for user in getattr(group, 'users', [])]
actors.sort(key=lambda actor: actor.get_label())
self.members = [each.get_link() for each in actors]
return self.template()
示例11: get_team_members
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def get_team_members(self):
return [Actor.user(user.userid) for user in self.model.group.users]
示例12: render_creator_link
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def render_creator_link(self):
return Actor.user(self.context.Creator()).get_link()
示例13: sortable_author
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def sortable_author(obj):
"""Index to allow users to sort on document_author."""
author = obj.document_author
if author:
return Actor.user(author).get_label()
return ''
示例14: actor
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def actor(self):
"""Returns a formatted link to the actor that created this version.
"""
principal = self.sys_metadata['principal']
actor = Actor.user(principal)
return actor.get_link()
示例15: get_responsible_actor
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import user [as 别名]
def get_responsible_actor(self):
return Actor.user(IDossier(self).responsible)