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


Python IMAP.has_folder方法代码示例

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


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

示例1: IMAP

# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import has_folder [as 别名]
    else:
        domain = conf.get('kolab', 'primary_domain')

    imap = IMAP()
    imap.connect(domain=domain, login=False)

    backend = conf.get(domain, 'imap_backend')
    if backend == None:
        backend = conf.get('kolab', 'imap_backend')

    admin_login = conf.get(backend, 'admin_login')
    admin_password = conf.get(backend, 'admin_password')

    imap.login_plain(admin_login, admin_password, user)

    if not imap.has_folder(folder_pattern):
        print >> sys.stderr, \
                _("Cannot subscribe user to folder %r:") % (folder_pattern), \
                _("No such folder")
        sys.exit(1)

    _folders = imap.lm(folder_pattern)
    _subscribed_folders = imap.lsub()
    unsubscribed_folders = []

    for _folder in _folders:
        if _folder in _subscribed_folders:
            imap.unsubscribe(_folder)
            unsubscribed_folders.append(_folder)

    if len(unsubscribed_folders) > 0:
开发者ID:tpokorra,项目名称:pykolab,代码行数:33,代码来源:cmd_remove_user_subscription.py

示例2: description

# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import has_folder [as 别名]
def description():
    return """Obtain a list of ACL entries on a folder."""

def execute(*args, **kw):
    try:
        folder = conf.cli_args.pop(0)
    except IndexError, errmsg:
        folder = utils.ask_question(_("Folder name"))

    if len(folder.split('@')) > 1:
        domain = folder.split('@')[1]
    else:
        domain = conf.get('kolab', 'primary_domain')

    imap = IMAP()
    imap.connect(domain=domain)

    if not imap.has_folder(folder):
        print >> sys.stderr, _("No such folder %r") % (folder)

    else:
        acls = []
        folders = imap.list_folders(folder)
        for folder in folders:
            print "Folder", folder
            acls = imap.list_acls(folder)

            for acl in acls.keys():
                print "  %-13s %s" %(acls[acl], acl)

开发者ID:tpokorra,项目名称:pykolab,代码行数:31,代码来源:cmd_list_mailbox_acls.py

示例3: _

# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import has_folder [as 别名]
        try:
            target_folder = conf.cli_args.pop(0)
            try:
                partition = conf.cli_args.pop(0)
            except IndexError, errmsg:
                partition = None
        except IndexError, errmsg:
            print >> sys.stderr, _("No target mailbox name specified")
    except IndexError, errmsg:
        print >> sys.stderr, _("No source mailbox name specified")
        sys.exit(1)

    if len(source_folder.split('@')) > 1:
        domain = source_folder.split('@')[1]
    else:
        domain = conf.get('kolab', 'primary_domain')

    imap = IMAP()
    imap.connect(domain=domain)

    if not imap.has_folder(source_folder):
        print >> sys.stderr, _("Source folder %r does not exist") % (source_folder)
        sys.exit(1)

    if imap.has_folder(target_folder) and partition == None:
        print >> sys.stderr, _("Target folder %r already exists") % (target_folder)
        sys.exit(1)

    imap.imap.rename(source_folder, target_folder, partition)

开发者ID:tpokorra,项目名称:pykolab,代码行数:31,代码来源:cmd_rename_mailbox.py


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