Remove old sha module import code
This commit is contained in:
parent
c5722011e8
commit
4afd1fa91d
|
@ -861,18 +861,16 @@ def create_auth_file():
|
|||
def create_localclient_account(append=False):
|
||||
import configmanager
|
||||
import random
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
auth_file = configmanager.get_config_dir("auth")
|
||||
if not os.path.exists(auth_file):
|
||||
create_auth_file()
|
||||
|
||||
try:
|
||||
from hashlib import sha1 as sha_hash
|
||||
except ImportError:
|
||||
from sha import new as sha_hash
|
||||
fd = open(auth_file, "a" if append else "w")
|
||||
fd.write(":".join([
|
||||
"localclient",
|
||||
sha_hash(str(random.random())).hexdigest(),
|
||||
sha(str(random.random())).hexdigest(),
|
||||
str(AUTH_LEVEL_ADMIN)
|
||||
]) + '\n')
|
||||
fd.flush()
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import os
|
||||
import warnings
|
||||
|
||||
try:
|
||||
from hashlib import sha1 as sha
|
||||
except ImportError:
|
||||
from sha import sha
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import reactor
|
||||
|
|
|
@ -42,13 +42,8 @@ import os
|
|||
import sys
|
||||
import logging
|
||||
import urlparse
|
||||
|
||||
import locale
|
||||
|
||||
try:
|
||||
from hashlib import sha1 as sha
|
||||
except ImportError:
|
||||
from sha import sha
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
from deluge import bencode
|
||||
from deluge.common import utf8_encoded, path_join
|
||||
|
|
|
@ -39,6 +39,7 @@ import pygtk
|
|||
pygtk.require('2.0')
|
||||
import gtk
|
||||
import logging
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.ui.client import client
|
||||
|
@ -541,11 +542,6 @@ class Preferences(component.Component):
|
|||
|
||||
:param hide: bool, if True, will not re-show the dialog and will hide it instead
|
||||
"""
|
||||
try:
|
||||
from hashlib import sha1 as sha_hash
|
||||
except ImportError:
|
||||
from sha import new as sha_hash
|
||||
|
||||
classic_mode_was_set = self.gtkui_config["classic_mode"]
|
||||
|
||||
# Get the values from the dialog
|
||||
|
@ -662,7 +658,7 @@ class Preferences(component.Component):
|
|||
self.builder.get_object("chk_enable_appindicator").get_active()
|
||||
new_gtkui_config["lock_tray"] = \
|
||||
self.builder.get_object("chk_lock_tray").get_active()
|
||||
passhex = sha_hash(self.builder.get_object("txt_tray_password").get_text()).hexdigest()
|
||||
passhex = sha(self.builder.get_object("txt_tray_password").get_text()).hexdigest()
|
||||
if passhex != "c07eb5a8c0dc7bb81c217b67f11c3b7a5e95ffd7":
|
||||
new_gtkui_config["tray_password"] = passhex
|
||||
|
||||
|
|
|
@ -437,10 +437,7 @@ class SystemTray(component.Component):
|
|||
set_value(widget.get_children()[0].get_text().split(" ")[0])
|
||||
|
||||
def unlock_tray(self, is_showing_dlg=[False]):
|
||||
try:
|
||||
from hashlib import sha1 as sha_hash
|
||||
except ImportError:
|
||||
from sha import new as sha_hash
|
||||
from hashlib import sha1 as sha
|
||||
|
||||
log.debug("Show tray lock dialog")
|
||||
|
||||
|
@ -488,7 +485,7 @@ class SystemTray(component.Component):
|
|||
|
||||
def on_response(dialog, response_id):
|
||||
if response_id == gtk.RESPONSE_OK:
|
||||
if self.config["tray_password"] == sha_hash(entered_pass.get_text()).hexdigest():
|
||||
if self.config["tray_password"] == sha(entered_pass.get_text()).hexdigest():
|
||||
self.window.present()
|
||||
|
||||
self.tray_lock.destroy()
|
||||
|
|
Loading…
Reference in New Issue