Changeset View
Changeset View
Standalone View
Standalone View
pykolab/cli/cmd_sync.py
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | my_option_group.add_option( | ||||
) | ) | ||||
def execute(*args, **kw): | def execute(*args, **kw): | ||||
global imap, pool | global imap, pool | ||||
auth = Auth() | auth = Auth() | ||||
if conf.domain == "all": | if conf.domain == "all": | ||||
log.debug(_("Listing domains..."), level=5) | log.debug(_("Listing domains..."), level=5) | ||||
Lint: PEP8 E111: indentation is not a multiple of four | |||||
start_time = time.time() | start_time = time.time() | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
domains = auth.list_domains() | domains = auth.list_domains() | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
end_time = time.time() | end_time = time.time() | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
log.debug( | log.debug( | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
_("Found %d domains in %d seconds") % ( | _("Found %d domains in %d seconds") % ( | ||||
len(domains), | len(domains), | ||||
(end_time-start_time) | (end_time-start_time) | ||||
), | ), | ||||
level=8 | level=8 | ||||
) | ) | ||||
else: | else: | ||||
domains = {} | domains = {} | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
domains[conf.domain] = conf.domain | domains[conf.domain] = conf.domain | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"): | if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"): | ||||
pool = multiprocessing.Pool(conf.threads, worker_process, (), 1) | pool = multiprocessing.Pool(conf.threads, worker_process, (), 1) | ||||
else: | else: | ||||
pool = multiprocessing.Pool(conf.threads, worker_process, ()) | pool = multiprocessing.Pool(conf.threads, worker_process, ()) | ||||
for primary_domain in list(set(domains.values())): | for primary_domain in list(set(domains.values())): | ||||
log.debug(_("Running for domain %s") % (primary_domain), level=8) | log.debug(_("Running for domain %s") % (primary_domain), level=8) | ||||
Show All 35 Lines | def _synchronize(*args, **kw): | ||||
if not 'kolabinetorgperson' in entry['objectclass']: | if not 'kolabinetorgperson' in entry['objectclass']: | ||||
return | return | ||||
imap = IMAP() | imap = IMAP() | ||||
imap.connect() | imap.connect() | ||||
if not imap.user_mailbox_exists(entry[mailbox_attribute]): | if not imap.user_mailbox_exists(entry[mailbox_attribute]): | ||||
if entry.has_key('mailhost'): | if 'mailhost' in entry: | ||||
server = entry['mailhost'] | server = entry['mailhost'] | ||||
else: | else: | ||||
server = None | server = None | ||||
imap.user_mailbox_create(entry[mailbox_attribute], server=server) | imap.user_mailbox_create(entry[mailbox_attribute], server=server) | ||||
imap.disconnect() | imap.disconnect() | ||||
indentation is not a multiple of four