From 65ccd2d7c130734d52b3c84ecf0dfc7b97cf5628 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Fri, 18 Jul 2008 02:09:54 +0000 Subject: [PATCH] Fix #355 support python 2.4 sha hashing --- deluge/ui/gtkui/preferences.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index c9b876fe6..98bf54e46 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -417,7 +417,11 @@ class Preferences(component.Component): def set_config(self): """Sets all altered config values in the core""" - import hashlib + try: + from hashlib import sha1 as sha_hash + except ImportError: + from sha import new as sha_hash + # Get the values from the dialog new_core_config = {} new_gtkui_config = {} @@ -520,7 +524,7 @@ class Preferences(component.Component): self.glade.get_widget("chk_start_in_tray").get_active() new_gtkui_config["lock_tray"] = \ self.glade.get_widget("chk_lock_tray").get_active() - passhex = hashlib.sha1(\ + passhex = sha_hash(\ self.glade.get_widget("txt_tray_password").get_text()).hexdigest() if passhex != "c07eb5a8c0dc7bb81c217b67f11c3b7a5e95ffd7": new_gtkui_config["tray_password"] = passhex