提交 cfd5cb30 编写于 作者: M Mike O'Connor

move mkdtmp to utils.temp_directory

Signed-off-by: NMike O'Connor <stew@vireo.org>
上级 a650ca81
......@@ -110,7 +110,7 @@ class Binary(object):
# a temporary directory
if not self.tmpdir:
tmpdir = tempfile.mkdtemp()
tmpdir = utils.temp_dirname()
cwd = os.getcwd()
try:
os.chdir( tmpdir )
......
......@@ -1484,6 +1484,20 @@ def temp_filename(directory=None, prefix="dak", suffix=""):
################################################################################
def temp_dirname(parent=None, prefix="dak", suffix=""):
"""
Return a secure and unique directory by pre-creating it.
If 'parent' is non-null, it will be the directory the directory is pre-created in.
If 'prefix' is non-null, the filename will be prefixed with it, default is dak.
If 'suffix' is non-null, the filename will end with it.
Returns a pathname to the new directory
"""
return tempfile.mkdtemp(suffix, prefix, directory)
################################################################################
def is_email_alias(email):
""" checks if the user part of the email is listed in the alias file """
global alias_cache
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册