本文整理汇总了Python中pykolab.imap.IMAP.list_folders方法的典型用法代码示例。如果您正苦于以下问题:Python IMAP.list_folders方法的具体用法?Python IMAP.list_folders怎么用?Python IMAP.list_folders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykolab.imap.IMAP
的用法示例。
在下文中一共展示了IMAP.list_folders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import list_folders [as 别名]
def execute(*args, **kw):
"""
Delete mailbox
"""
if len(conf.cli_args) < 1:
print >> sys.stderr, _("No mailbox specified")
sys.exit(1)
imap = IMAP()
imap.connect()
delete_folders = []
while len(conf.cli_args) > 0:
folder = conf.cli_args.pop(0)
folders = imap.list_folders(folder)
if len(folders) < 1:
print >> sys.stderr, _("No such folder(s): %s") % (folder)
delete_folders.extend(folders)
if len(delete_folders) == 0:
print >> sys.stderr, _("No folders to delete.")
sys.exit(1)
for delete_folder in delete_folders:
try:
imap.delete_mailfolder(delete_folder)
except Exception, errmsg:
log.error(_("Could not delete mailbox '%s'") % (delete_folder))
示例2: description
# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import list_folders [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: IMAP
# 需要导入模块: from pykolab.imap import IMAP [as 别名]
# 或者: from pykolab.imap.IMAP import list_folders [as 别名]
try:
quota_folder = conf.cli_args.pop(0)
except IndexError, e:
quota_folder = '*'
imap = IMAP()
if not conf.connect_server == None:
imap.connect(server=conf.connect_server)
else:
imap.connect()
folders = []
quota_folders = imap.list_folders(quota_folder)
for quota_folder in quota_folders:
try:
(used, quota) = imap.get_quota(quota_folder)
print "Folder: %s" % (quota_folder)
if not used == None and not quota == None:
if quota == 0:
print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
print "%d (Used: %d, Percentage: %s)" % (quota, used, u'\u221E')
else:
percentage = round(((float)(used)/(float)(quota)) * 100.0, 1)
print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
else:
if used == None:
print "%d (Used: %d, Percentage: %d)" % (quota, 0, 0)
else: