MCPcopy
hub / github.com/OfflineIMAP/offlineimap / gethost

Method gethost

offlineimap/repository/IMAP.py:118–148  ·  view source on GitHub ↗

Return the configured hostname to connect to :returns: hostname as string or throws Exception

(self)

Source from the content-addressed store, hash-verified

116 return self.imapserver.delim
117
118 def gethost(self):
119 """Return the configured hostname to connect to
120
121 :returns: hostname as string or throws Exception"""
122 if self._host: # Use cached value if possible.
123 return self._host
124
125 # 1) Check for remotehosteval setting.
126 if self.config.has_option(self.getsection(), 'remotehosteval'):
127 host = self.getconf('remotehosteval')
128 try:
129 host = self.localeval.eval(host)
130 except Exception as e:
131 six.reraise(OfflineImapError,
132 OfflineImapError(
133 "remotehosteval option for repository "
134 "'%s' failed:\n%s"% (self, e),
135 OfflineImapError.ERROR.REPO),
136 exc_info()[2])
137 if host:
138 self._host = host
139 return self._host
140 # 2) Check for plain remotehost setting.
141 host = self.getconf('remotehost', None)
142 if host != None:
143 self._host = host
144 return self._host
145
146 # No success.
147 raise OfflineImapError("No remote host for repository "
148 "'%s' specified."% self, OfflineImapError.ERROR.REPO)
149
150 def get_remote_identity(self):
151 """Remote identity is used for certain SASL mechanisms

Callers 4

getuserMethod · 0.95
getpasswordMethod · 0.95
__init__Method · 0.45
serverdiagnosticsMethod · 0.45

Calls 4

OfflineImapErrorClass · 0.90
getconfMethod · 0.80
evalMethod · 0.80
getsectionMethod · 0.45

Tested by

no test coverage detected