本文整理汇总了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:
示例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)
示例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)