Projects
Kolab:3.4
pykolab
0002-Use-the-correct-scheme-hostname-and-port-i...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Use-the-correct-scheme-hostname-and-port-if-so-confi.patch of Package pykolab (Revision 124)
Currently displaying revision
124
,
Show latest
From 5db950d92bebf130d09fc7aeb53e3d0241aa84af Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> Date: Tue, 9 Dec 2014 19:18:08 +0100 Subject: [PATCH 2/4] Use the correct scheme, hostname and port if so configured --- pykolab/imap/__init__.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py index 23bf4a9..cf6ff07 100644 --- a/pykolab/imap/__init__.py +++ b/pykolab/imap/__init__.py @@ -122,7 +122,15 @@ class IMAP(object): result = urlparse(uri) - if hasattr(result, 'hostname'): + if hasattr(result, 'netloc'): + scheme = result.scheme + if len(result.netloc.split(':')) > 1: + hostname = result.netloc.split(':')[0] + port = result.netloc.split(':')[1] + else: + hostname = result.netloc + + elif hasattr(result, 'hostname'): hostname = result.hostname else: scheme = uri.split(':')[0] @@ -131,12 +139,17 @@ class IMAP(object): if not server == None: hostname = server - if port == None: - port = 993 - if scheme == None or scheme == "": scheme = 'imaps' + if port == None: + if scheme == "imaps": + port = 993 + elif scheme == "imap": + port = 143 + else: + port = 993 + uri = '%s://%s:%s' % (scheme, hostname, port) # Get the credentials -- 1.9.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.