當前位置: 首頁>>代碼示例>>Python>>正文


Python Auth.synchronize方法代碼示例

本文整理匯總了Python中pykolab.auth.Auth.synchronize方法的典型用法代碼示例。如果您正苦於以下問題:Python Auth.synchronize方法的具體用法?Python Auth.synchronize怎麽用?Python Auth.synchronize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pykolab.auth.Auth的用法示例。


在下文中一共展示了Auth.synchronize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: execute

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import synchronize [as 別名]
def execute(*args, **kw):
    auth = Auth()
    log.debug(_("Listing domains..."), level=5)
    start_time = time.time()
    domains = auth.list_domains()
    end_time = time.time()
    log.debug(
            _("Found %d domains in %d seconds") % (
                    len(domains),
                    (end_time-start_time)
                ),
            level=8
        )

    all_folders = []

    for primary_domain,secondary_domains in domains:
        log.debug(_("Running for domain %s") % (primary_domain), level=8)
        auth.connect(primary_domain)
        start_time = time.time()
        auth.synchronize()
        end_time = time.time()

        log.info(_("Synchronizing users for %s took %d seconds")
                % (primary_domain, (end_time-start_time))
            )
開發者ID:detrout,項目名稱:pykolab,代碼行數:28,代碼來源:cmd_sync.py

示例2: execute

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import synchronize [as 別名]
def execute(*args, **kw):
    global imap, pool

    auth = Auth()
    log.debug(_("Listing domains..."), level=5)
    start_time = time.time()
    domains = auth.list_domains()
    end_time = time.time()
    log.debug(
            _("Found %d domains in %d seconds") % (
                    len(domains),
                    (end_time-start_time)
                ),
            level=8
        )

    if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"):
        pool = multiprocessing.Pool(conf.threads, worker_process, (), 1)
    else:
        pool = multiprocessing.Pool(conf.threads, worker_process, ())

    for primary_domain in list(set(domains.values())):
        log.debug(_("Running for domain %s") % (primary_domain), level=8)
        auth = Auth(primary_domain)
        auth.connect(primary_domain)
        start_time = time.time()
        auth.synchronize(mode='_paged_search', callback=queue_add)
        end_time = time.time()

        log.info(_("Synchronizing users for %s took %d seconds")
                % (primary_domain, (end_time-start_time))
            )

    while not pool._taskqueue.empty():
        time.sleep(1)
開發者ID:tpokorra,項目名稱:pykolab,代碼行數:37,代碼來源:cmd_sync.py

示例3: synchronize

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import synchronize [as 別名]
    def synchronize(self, domain):
        sync_interval = conf.get('kolab', 'sync_interval')

        if sync_interval == None or sync_interval == 0:
            sync_interval = 300
        else:
            sync_interval = (int)(sync_interval)

        while True:
            try:
                auth = Auth(domain)
                auth.connect(domain)
                auth.synchronize()
                time.sleep(sync_interval)
            except KeyboardInterrupt:
                break
            except Exception, errmsg:
                log.error(_("Error in process %r, terminating: %r") % (self.name, errmsg))
                import traceback
                traceback.print_exc()
                time.sleep(1)
開發者ID:detrout,項目名稱:pykolab,代碼行數:23,代碼來源:process.py

示例4: synchronize_once

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import synchronize [as 別名]
def synchronize_once():
    auth = Auth()
    auth.connect()
    auth.synchronize(mode='_paged_search')
開發者ID:tpokorra,項目名稱:pykolab,代碼行數:6,代碼來源:synchronize.py


注:本文中的pykolab.auth.Auth.synchronize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。