Introduce CustomConfig method that applies set of transforms
It is a bit cleaner than making chains of calls like {{{ value = os.path.expanduser(value) value = os.path.abspath(value) }}} since we do see all transformations to be applied in a single iterable and have no repeated code like in the above example. Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
@ -201,11 +201,11 @@ class IMAPRepository(BaseRepository):
|
||||
|
||||
def getsslcacertfile(self):
|
||||
"""Return the absolute path of the CA certfile to use, if any"""
|
||||
cacertfile = self.getconf('sslcacertfile', get_os_sslcertfile())
|
||||
xforms = [os.path.expanduser, os.path.abspath]
|
||||
cacertfile = self.getconf_xform('sslcacertfile', xforms,
|
||||
get_os_sslcertfile())
|
||||
if cacertfile is None:
|
||||
return None
|
||||
cacertfile = os.path.expanduser(cacertfile)
|
||||
cacertfile = os.path.abspath(cacertfile)
|
||||
if not os.path.isfile(cacertfile):
|
||||
raise SyntaxWarning("CA certfile for repository '%s' could "
|
||||
"not be found. No such file: '%s'" \
|
||||
|
@ -61,7 +61,8 @@ class MaildirRepository(BaseRepository):
|
||||
os.utime(cur_dir, (cur_atime, os.path.getmtime(cur_dir)))
|
||||
|
||||
def getlocalroot(self):
|
||||
return os.path.expanduser(self.getconf('localfolders'))
|
||||
xforms = [os.path.expanduser]
|
||||
return self.getconf_xform('localfolders', xforms)
|
||||
|
||||
def debug(self, msg):
|
||||
self.ui.debug('maildir', msg)
|
||||
|
Reference in New Issue
Block a user