当前位置: 首页>>代码示例>>Python>>正文


Python IWorkspace.items方法代码示例

本文整理汇总了Python中collective.workspace.interfaces.IWorkspace.items方法的典型用法代码示例。如果您正苦于以下问题:Python IWorkspace.items方法的具体用法?Python IWorkspace.items怎么用?Python IWorkspace.items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collective.workspace.interfaces.IWorkspace的用法示例。


在下文中一共展示了IWorkspace.items方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: existing_users

# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import items [as 别名]
def existing_users(context):
    """
    Look up the full user details for current workspace members
    """
    members = IWorkspace(context).members
    info = []
    for userid, details in members.items():
        user = api.user.get(userid)
        if user is None:
            continue
        user = user.getUser()
        title = user.getProperty('fullname') or user.getId() or userid
        # XXX tbd, we don't know what a persons description is, yet
        description = ''
        classes = description and 'has-description' or 'has-no-description'
        portal = api.portal.get()
        portrait = '%s/@@avatars/%s' % \
                   (portal.absolute_url(), userid)
        info.append(
            dict(
                id=userid,
                title=title,
                description=description,
                portrait=portrait,
                cls=classes,
                member=True,
                admin='Admins' in details['groups'],
            )
        )

    return info
开发者ID:sudhan77,项目名称:ploneintranet,代码行数:33,代码来源:utils.py

示例2: existing_users

# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import items [as 别名]
    def existing_users(self):
        """
        Look up the full user details for current workspace members
        """
        members = IWorkspace(self).members
        info = []
        for userid, details in members.items():
            user = api.user.get(userid)
            if user is None:
                continue
            user = user.getUser()
            title = user.getProperty('fullname') or user.getId() or userid
            # XXX tbd, we don't know what a persons description is, yet
            description = MessageFactory(u'Here we could have a nice status of'
                                         u' this person')
            classes = description and 'has-description' or 'has-no-description'
            portrait = pi_api.userprofile.avatar_url(userid)
            info.append(
                dict(
                    id=userid,
                    title=title,
                    description=description,
                    portrait=portrait,
                    cls=classes,
                    member=True,
                    admin='Admins' in details['groups'],
                )
            )

        return info
开发者ID:smcmahon,项目名称:ploneintranet,代码行数:32,代码来源:workspacefolder.py

示例3: existing_users

# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import items [as 别名]
def existing_users(context):
    """
    Look up the full user details for current workspace members
    """
    members = IWorkspace(context).members
    info = []
    for userid, details in members.items():
        user = api.user.get(userid)
        if user is None:
            continue
        user = user.getUser()
        title = user.getProperty("fullname") or user.getId() or userid
        # XXX tbd, we don't know what a persons description is, yet
        description = _(u"Here we could have a nice status of this person")
        classes = description and "has-description" or "has-no-description"
        portal = api.portal.get()
        portrait = "%s/portal_memberdata/portraits/%s" % (portal.absolute_url(), userid)
        info.append(
            dict(
                id=userid,
                title=title,
                description=description,
                portrait=portrait,
                cls=classes,
                member=True,
                admin="Admins" in details["groups"],
            )
        )

    return info
开发者ID:ploneintranet,项目名称:ploneintranet.workspace,代码行数:32,代码来源:utils.py

示例4: existing_users

# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import items [as 别名]
    def existing_users(self):
        members = IWorkspace(self.context).members
        info = []
        for userid, details in members.items():
            user = api.user.get(userid).getUser()
            title = user.getProperty('fullname') or user.getId() or userid
            info.append(
                dict(
                    id=userid,
                    title=title,
                    member=True,
                    admin='Admins' in details['groups'],
                )
            )

        return info
开发者ID:zestsoftware,项目名称:ploneintranet.workspace,代码行数:18,代码来源:roster.py

示例5: existing_users

# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import items [as 别名]
    def existing_users(self):
        """
        Look up the full user details for current workspace members
        """
        members = IWorkspace(self).members
        info = []

        for user_or_group_id, details in members.items():
            user = api.user.get(user_or_group_id)
            if user is not None:
                user = user.getUser()
                title = (user.getProperty('fullname') or user.getId() or
                         user_or_group_id)
                # XXX tbd, we don't know what a persons description is, yet
                description = ''
                classes = 'user ' + (description and 'has-description'
                                     or 'has-no-description')
                portrait = pi_api.userprofile.avatar_url(user_or_group_id)
            else:
                group = api.group.get(user_or_group_id)
                if group is None:
                    continue
                title = (group.getProperty('title') or group.getId() or
                         user_or_group_id)
                description = _(
                    u"number_of_members",
                    default=u'${no_members} Members',
                    mapping={
                        u'no_members': len(group.getAllGroupMemberIds())})
                classes = 'user-group has-description'
                portrait = ''

            # User's 'role' is any group they are a member of
            # that is not the default participation policy group
            # (including Admins group)
            role = None
            groups = details['groups']
            if 'Admins' in groups:
                role = 'Admin'
            for policy in PARTICIPANT_POLICY:
                if policy == self.participant_policy:
                    continue
                if policy.title() in groups:
                    role = PARTICIPANT_POLICY[policy]['title']
                    # According to the design there is at most one extra role
                    # per user, so we go with the first one we find. This may
                    # not be enforced in the backend though.
                    break
            if role:
                classes += ' has-label'

            info.append(
                dict(
                    id=user_or_group_id,
                    title=title,
                    description=description,
                    portrait=portrait,
                    cls=classes,
                    member=True,
                    admin='Admins' in details['groups'],
                    role=role,
                )
            )

        return info
开发者ID:sudhan77,项目名称:ploneintranet,代码行数:67,代码来源:workspacefolder.py


注:本文中的collective.workspace.interfaces.IWorkspace.items方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。