From 692e35e1c5a9a1aa9b39404aebbb97dcccb6a93e Mon Sep 17 00:00:00 2001 From: Leonardo Date: Tue, 15 Jun 2010 10:46:30 +0200 Subject: [PATCH] Aggiunta gestione degli errori nello spostamento --- example_script.py | 5 +++++ mlmanager.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/example_script.py b/example_script.py index 64b1d62..6ed72e1 100755 --- a/example_script.py +++ b/example_script.py @@ -27,6 +27,11 @@ mlmanager.mail_server = "localhost" # Users that should be notified on error, default is "owner" mlmanager.error_recipients = [ "owner", "admin@example.org" ] +# Incoming directory for your mldonkey downloads. Directory are not handled now +# This is the default so it really doesn't matter that you set it if it is +# /var/lib/mldonkey/incoming/files +mlmanager.files_incoming = "/var/lib/mldonkey/incoming/files" + # Our mldonkey supports auto commit so we don't need username and password, but we # could also use download = mlmanager.Download(username = "user", password = "password") download = mlmanager.Download() diff --git a/mlmanager.py b/mlmanager.py index bfd8684..6ea69d0 100644 --- a/mlmanager.py +++ b/mlmanager.py @@ -255,6 +255,10 @@ class Download(): if not destination_folder.endswith(os.path.sep): destination_folder += os.path.sep + if not os.path.exists(destination_folder): + self._notify_error("Destination directory %s does not exists" % destination_folder) + return + shutil.move (self._dest_path, destination_folder + filename) # Update _dest_path @@ -270,6 +274,7 @@ class Download(): if not self._committed: self.commit() + shutil.copy(self._dest_path, destination) -- 2.1.4