From: Ansgar Burchardt Date: Fri, 15 Jun 2012 13:42:10 +0000 (+0200) Subject: fstransactions.py: allow mode to be a string X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=36cc95dbcd4f564647726201b117f03b4183c232;hp=c5501640d444217e7cdbb5e42e31166cd1fe2db6;p=dak.git fstransactions.py: allow mode to be a string --- diff --git a/daklib/fstransactions.py b/daklib/fstransactions.py index 468e2859..f76a4bc6 100644 --- a/daklib/fstransactions.py +++ b/daklib/fstransactions.py @@ -134,6 +134,9 @@ class FilesystemTransaction(object): symlink (bool): Create a symlink instead mode (int): Permissions to change `destination` to. """ + if isinstance(mode, str) or isinstance(mode, unicode): + mode = int(mode, 8) + self.actions.append(_FilesystemCopyAction(source, destination, link=link, symlink=symlink, mode=mode)) def move(self, source, destination, mode=None): @@ -169,6 +172,9 @@ class FilesystemTransaction(object): Returns: file handle of the new file """ + if isinstance(mode, str) or isinstance(mode, unicode): + mode = int(mode, 8) + destdir = os.path.dirname(path) if not os.path.exists(destdir): os.makedirs(destdir, 0o2775)