From fe213702caefdfe6ae37b8f836cc08cf05d7ce5e Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 25 Jun 2010 18:38:08 +0200 Subject: [PATCH] Added support for chmoding files. --- mlmanager.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mlmanager.py b/mlmanager.py index 35d0fce..a01fcc8 100644 --- a/mlmanager.py +++ b/mlmanager.py @@ -49,7 +49,7 @@ archive_extensions = [ 'rar', 'zip', '7z', 'tar.gz', 'tar.bz2', 'lzo' ] __author__ = "Leonardo Robol " -import os, sys, socket, shutil, subprocess, time, smtplib +import os, sys, socket, shutil, subprocess, time, smtplib, stat from email.mime.text import MIMEText class FileType(): @@ -283,6 +283,19 @@ class Download(): shutil.copy(self._dest_path, destination) + def make_group_writable(self): + """ + Chmod the file so that group users can move it. This can be useful + because often mldonkey user is not the user that needs to organize + the downloads + """ + os.chmod(self._dest_file, stat.S_IRGRP) + os.chmod(self._dest_file, stat.S_IWGRP) + + def make_public(self): + """Make the file public, i.e. let anyone modify it.""" + os.chmod(self._dest_file, stat.S_IROTH) + os.chmod(self._dest_file, stat.S_IWOTH) def rsync(self, remote_destination): """Rsync the file to the remote destination. There must be an ssh key -- 2.1.4