X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=c1be6b9014950f2ec798f09ee14b3aaac9599944;hb=4764b7c2bdd0e3203dbd7cd3b871138c58c3855c;hp=96bc9befd8bc920379983d3a1babd11c7cf6448f;hpb=1af0343f2bcab92549d41426be7acd4fe7361206;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index 96bc9bef..c1be6b90 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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, parent) + +################################################################################ + def is_email_alias(email): """ checks if the user part of the email is listed in the alias file """ global alias_cache