From 36cc95dbcd4f564647726201b117f03b4183c232 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Fri, 15 Jun 2012 15:42:10 +0200 Subject: [PATCH] fstransactions.py: allow mode to be a string --- daklib/fstransactions.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.39.5