move from sha module to hashlib module for 2.6 support

This commit is contained in:
Marcos Pinto 2008-07-15 22:18:37 +00:00
parent bbddd29d4b
commit 67ee5000ad
2 changed files with 6 additions and 6 deletions

View File

@ -417,7 +417,7 @@ class Preferences(component.Component):
def set_config(self):
"""Sets all altered config values in the core"""
import sha
import hashlib
# Get the values from the dialog
new_core_config = {}
new_gtkui_config = {}
@ -520,8 +520,8 @@ 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 = sha.new(self.glade.get_widget("txt_tray_password").get_text())\
.hexdigest()
passhex = hashlib.sha1(\
self.glade.get_widget("txt_tray_password").get_text()).hexdigest()
if passhex != "c07eb5a8c0dc7bb81c217b67f11c3b7a5e95ffd7":
new_gtkui_config["tray_password"] = passhex
new_gtkui_config["classic_mode"] = \

View File

@ -336,7 +336,7 @@ class SystemTray(component.Component):
self.build_tray_bwsetsubmenu()
def unlock_tray(self, is_showing_dlg=[False]):
import sha
import hashlib
log.debug("Show tray lock dialog")
result = False
@ -363,8 +363,8 @@ window, please enter your password"))
tray_lock.vbox.pack_start(entered_pass)
tray_lock.show_all()
if tray_lock.run() == gtk.RESPONSE_ACCEPT:
if self.config["tray_password"] == sha.new(entered_pass.get_text())\
.hexdigest():
if self.config["tray_password"] == hashlib.sha1(\
entered_pass.get_text()).hexdigest():
result = True
tray_lock.destroy()
is_showing_dlg[0] = False