mirror of https://github.com/tLDP/python-tldp
allow None as the b argument
This commit is contained in:
parent
4fbc08c1be
commit
99d93fb4ce
|
@ -85,7 +85,7 @@ def swapdirs(a, b):
|
||||||
if not os.path.isdir(a):
|
if not os.path.isdir(a):
|
||||||
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), a)
|
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), a)
|
||||||
tname = None
|
tname = None
|
||||||
if os.path.exists(b):
|
if b and os.path.exists(b):
|
||||||
tdir = mkdtemp(prefix='swapdirs-', dir=opd(opa(a)))
|
tdir = mkdtemp(prefix='swapdirs-', dir=opd(opa(a)))
|
||||||
logger.debug("Created tempdir %s.", tdir)
|
logger.debug("Created tempdir %s.", tdir)
|
||||||
tname = opj(tdir, opb(b))
|
tname = opj(tdir, opb(b))
|
||||||
|
|
Loading…
Reference in New Issue