Merge pull request #51 from sudipm-mukherjee/fix_remotepassfile
Right format for password from remotepassfile
This commit is contained in:
commit
76c7a723db
@ -601,7 +601,20 @@ class IMAPRepository(BaseRepository):
|
||||
encoding='utf-8')
|
||||
password = file_desc.readline().strip()
|
||||
file_desc.close()
|
||||
return password.encode('UTF-8')
|
||||
|
||||
# We need a str password
|
||||
if isinstance(password, bytes):
|
||||
return password.decode(encoding='utf-8')
|
||||
elif isinstance(password, str):
|
||||
return password
|
||||
|
||||
# If is not bytes or str, we have a problem
|
||||
raise OfflineImapError("Could not get a right password format for"
|
||||
" repository %s. Type found: %s. "
|
||||
"Please, open a bug." %
|
||||
(self.name, type(password)),
|
||||
OfflineImapError.ERROR.FOLDER)
|
||||
|
||||
# 4. Read password from ~/.netrc.
|
||||
try:
|
||||
netrcentry = netrc.netrc().authenticators(self.gethost())
|
||||
|
Loading…
Reference in New Issue
Block a user