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


Python Utils.list_names方法代码示例

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


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

示例1: lists_of_member

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def lists_of_member(safeuser):
    hostname = mm_cfg.DEFAULT_URL_HOST
    onlists = []
    for listname in Utils.list_names():
        # The current list will always handle things in the mainline
        if listname == Utils.list_names():
            continue
        glist = MailList.MailList(listname, lock=0)
        if glist.host_name <> hostname:
            continue
        if not glist.isMember(safeuser):
            continue
        onlists.append(glist)
    return onlists
开发者ID:jdk2588,项目名称:systers-gsoc10-membership,代码行数:16,代码来源:oiduserpage.py

示例2: list_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def list_lists():
    """Lists existing mailing lists on the server.

    **Method**: GET

    **URI**: /v2/

    Returns a list of dictionaries the mailing lists and its public attributes
    that exist on this server."""

    all_lists = Utils.list_names()
    lists = []

    address = request.query.get('address')
    for listname in all_lists:
        if listname == Defaults.MAILMAN_SITE_LIST:
            continue

        mlist = get_mailinglist(listname, lock=False)

        members = mlist.getMembers()
        if not address or address in members:
            list_values = {
                'listname': listname,
                'archive_private': mlist.archive_private,
                'real_name': mlist.real_name,
                'description': mlist.description,
            }

            lists.append(list_values)

    return jsonify(lists)
开发者ID:JeffBackwards,项目名称:mailman-api,代码行数:34,代码来源:apiv2.py

示例3: process

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def process(res, args):
    mlist = res.mlist
    if args:
        res.results.append(_('Usage:'))
        res.results.append(gethelp(mlist))
        return STOP
    hostname = mlist.host_name
    res.results.append(_('Public mailing lists at %(hostname)s:'))
    lists = Utils.list_names()
    lists.sort()
    i = 1
    for listname in lists:
        if listname == mlist.internal_name():
            xlist = mlist
        else:
            xlist = MailList(listname, lock=0)
        # We can mention this list if you already know about it
        if not xlist.advertised and xlist is not mlist:
            continue
        # Skip the list if it isn't in the same virtual domain.  BAW: should a
        # message to the site list include everything regardless of domain?
        if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
               xlist.host_name <> mlist.host_name:
            continue
        realname = xlist.real_name
        description = xlist.description or _('n/a')
        requestaddr = xlist.GetRequestEmail()
        if i > 1:
            res.results.append('')
        res.results.append(_('%(i)3d. List name:   %(realname)s'))
        res.results.append(_('     Description: %(description)s'))
        res.results.append(_('     Requests to: %(requestaddr)s'))
        i += 1
开发者ID:EmilyDirsh,项目名称:Paperboy,代码行数:35,代码来源:cmd_lists.py

示例4: get_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def get_lists():
    names = Utils.list_names()
    names.sort()
    committees = OfficerPosition.objects.all()
    committee_lists = {}
    for committee in committees:
        if committee.mailing_list:
            committee_lists[committee.mailing_list] = committee
    mlists = []
    for name in names:
        try:
            mlist = MailList.MailList(name, lock=False)
        except IOError:
            continue
        mlist_item = {
            'name': mlist.internal_name(),
            'url': mlist.GetScriptURL('listinfo', absolute=1),
            'adminurl': mlist.GetScriptURL('admin', absolute=1),
            'description': mlist.description,
            'public': True if mlist.advertised else False,
        }
        if mlist.internal_name() in committee_lists:
            mlist_item['position'] = committee_lists[mlist.internal_name()]
        mlists.append(mlist_item)

    return mlists
开发者ID:nbailey,项目名称:quark,代码行数:28,代码来源:utils.py

示例5: get_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def get_lists(userdesc, perms, vhost, email=None):
    """ List available lists for the given vhost
    """
    if email is None:
        udesc = userdesc
    else:
        udesc = UserDesc(email.lower(), email.lower(), None, 0)
    prefix = vhost.lower()+VHOST_SEP
    names = Utils.list_names()
    names.sort()
    result = []
    for name in names:
        if not name.startswith(prefix):
            continue
        try:
            mlist = MailList.MailList(name, lock=0)
        except:
            continue
        try:
            details = get_list_info(udesc, perms, mlist, (email is None and vhost == PLATAL_DOMAIN))
            if details is not None:
                result.append(details[0])
        except Exception, e:
            sys.stderr.write('Can\'t get list %s: %s\n' % (name, str(e)))
            continue
开发者ID:Ekleog,项目名称:platal,代码行数:27,代码来源:lists.rpc.py

示例6: kill

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def kill(userdesc, perms, vhost, forlife, promo, del_from_promo):
    """ Remove a user from all the lists.

    Args:
        forlife: the user's forlife email
        promo: the user's promo, if any (format: X2006)
        del_from_promo: bool, whether to delete from the promo lists as well.
    """
    exclude = []
    if promo and promo[0] == 'X' and not del_from_promo:
        exclude.append(PLATAL_DOMAIN + VHOST_SEP + 'promo' + promo[1:])
    for list in Utils.list_names():
        if list in exclude:
            continue
        try:
            mlist = MailList.MailList(list, lock=0)
        except:
            continue
        try:
            mlist.Lock()
            mlist.ApprovedDeleteMember(forlife, None, 0, 0)
            mlist.Save()
            mlist.Unlock()
        except:
            mlist.Unlock()
    return 1
开发者ID:Ekleog,项目名称:platal,代码行数:28,代码来源:lists.rpc.py

示例7: list_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def list_lists():
    """Lists existing mailing lists on the server.

    **Method**: GET

    **URI**: /

    Returns a list of the mailing lists that exist on this server."""

    all_lists = Utils.list_names()
    lists = []

    include_description = request.query.get('description')
    include_private = request.query.get('private')

    address = request.query.get('address')
    for listname in all_lists:
        mlist = get_mailinglist(listname, lock=False)
        members = mlist.getMembers()
        if not address or address in members:
            list_values = [listname]
            if include_description:
                list_values.append(mlist.description.decode('latin1'))
            if include_private:
                list_values.append(bool(mlist.archive_private))

            if len(list_values) == 1:
                lists.append(list_values[0])
            else:
                lists.append(list_values)

    return jsonify(lists)
开发者ID:macartur,项目名称:mailman-api,代码行数:34,代码来源:api.py

示例8: getLists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def getLists():
    names = Utils.list_names()
    names.sort()

    mailinglists = []
    for n in names:
        mailinglists.append(UCPMailingList(n))

    return mailinglists
开发者ID:Scrik,项目名称:ucp,代码行数:11,代码来源:ucp_mailman.py

示例9: create_list

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
    def create_list(cls, list_name, list_admin='[email protected]',
                    list_pass='123456', subscribe_policy=0):
        if list_name in Utils.list_names():
            return

        m = MailList.MailList()
        m.Create(list_name, list_admin, list_pass)
        m.subscribe_policy = subscribe_policy
        m.Save()
        m.Unlock()
开发者ID:JeffBackwards,项目名称:mailman-api,代码行数:12,代码来源:utils.py

示例10: _oneloop

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
 def _oneloop(self):
     # Refresh this each time through the list.  BAW: could be too
     # expensive.
     listnames = Utils.list_names()
     # Cruise through all the files currently in the new/ directory
     try:
         files = os.listdir(self._dir)
     except OSError, e:
         if e.errno <> errno.ENOENT: raise
         # Nothing's been delivered yet
         return 0
开发者ID:EmilyDirsh,项目名称:Paperboy,代码行数:13,代码来源:MaildirRunner.py

示例11: get_all_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def get_all_lists(userdesc, perms, vhost):
    """ Get all the list for the given vhost
            @root
    """
    prefix = vhost.lower()+VHOST_SEP
    names = Utils.list_names()
    names.sort()
    result = []
    for name in names:
        if not name.startswith(prefix):
            continue
        result.append(name.replace(prefix, ''))
    return result
开发者ID:Ekleog,项目名称:platal,代码行数:15,代码来源:lists.rpc.py

示例12: lists_of_member

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def lists_of_member(mlist, user):
    hostname = mlist.host_name
    onlists = []
    for listname in Utils.list_names():
        # The current list will always handle things in the mainline
        if listname == mlist.internal_name():
            continue
        glist = MailList.MailList(listname, lock=0)
        if glist.host_name <> hostname:
            continue
        if not glist.isMember(user):
            continue
        onlists.append(glist)
    return onlists
开发者ID:jurov,项目名称:gnu-mailman,代码行数:16,代码来源:options.py

示例13: all_mls

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
    def all_mls (self):
        """A dictionary of listname to corresponding MailList objects. The
        lists are not locked. This is an important thing to keep in mind.

        This is potentially time consuming to create for every call. We may
        revisit this as a potential performance improvement. FIXME"""

        if self._all_mls:
            return self._all_mls

        self._all_mls = {}
        for name in Utils.list_names():
            self._all_mls[name] = MailList.MailList(name, lock=0)

        return self._all_mls
开发者ID:skarra,项目名称:GNU-Mailman-SSO,代码行数:17,代码来源:ctl.py

示例14: import_lists

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def import_lists(prefix):
    '''
        Imports lists named with the given prefix from mailman
        into the compsoc website.
        Caveat: they have to be subscribed using the same email
        address they use for the compsoc website.
    '''
    for list_name in Utils.list_names():
        if list_name.startswith(prefix):
            list,new = MailingList.objects.get_or_create(list=list_name)
            mailman_list = MailList.MailList(list_name, lock=False)
            members = mailman_list.getMemberCPAddresses(mailman_list.getRegularMemberKeys()+mailman_list.getDigestMemberKeys())
            for member in members:
                try:
                    list.users.add(User.objects.get(email=member))
                except User.DoesNotExist: pass
开发者ID:esteluk,项目名称:reinhardt,代码行数:18,代码来源:mailman.py

示例15: list_attr

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import list_names [as 别名]
def list_attr(listname):
    """Returns basic attributes of specific list.

    **Method**: GET

    **URI**: /v3/<listname>

    Returns a dictionary containing the basic attributes for 
    a specific mailing list that exist on this server."""

    all_lists = Utils.list_names()
    lists = []

    try:
        mlist = get_mailinglist(listname)
    except Errors.MMUnknownListError, e:
        return jsonify(ERRORS_CODE[e.__class__.__name__])
开发者ID:JeffBackwards,项目名称:mailman-api,代码行数:19,代码来源:apiv3.py


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