Changeset 4afd1fa


Ignore:
Timestamp:
07/05/2014 06:43:07 PM (11 years ago)
Author:
Calum Lind <calumlind+deluge@gmail.com>
Branches:
2.0.x, develop, master
Children:
30e5fc
Parents:
c57220
Message:

Remove old sha module import code

Location:
deluge
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • deluge/common.py

    rc57220 r4afd1fa  
    862862    import configmanager
    863863    import random
     864    from hashlib import sha1 as sha
     865
    864866    auth_file = configmanager.get_config_dir("auth")
    865867    if not os.path.exists(auth_file):
    866868        create_auth_file()
    867869
    868     try:
    869         from hashlib import sha1 as sha_hash
    870     except ImportError:
    871         from sha import new as sha_hash
    872870    fd = open(auth_file, "a" if append else "w")
    873871    fd.write(":".join([
    874872        "localclient",
    875         sha_hash(str(random.random())).hexdigest(),
     873        sha(str(random.random())).hexdigest(),
    876874        str(AUTH_LEVEL_ADMIN)
    877875    ]) + '\n')
  • deluge/tests/test_core.py

    rc57220 r4afd1fa  
    11import os
    22import warnings
    3 
    4 try:
    5     from hashlib import sha1 as sha
    6 except ImportError:
    7     from sha import sha
     3from hashlib import sha1 as sha
    84
    95from twisted.trial import unittest
  • deluge/ui/common.py

    rc57220 r4afd1fa  
    4343import logging
    4444import urlparse
    45 
    4645import locale
    47 
    48 try:
    49     from hashlib import sha1 as sha
    50 except ImportError:
    51     from sha import sha
     46from hashlib import sha1 as sha
    5247
    5348from deluge import bencode
  • deluge/ui/gtkui/preferences.py

    rc57220 r4afd1fa  
    4040import gtk
    4141import logging
     42from hashlib import sha1 as sha
    4243
    4344import deluge.component as component
     
    542543        :param hide: bool, if True, will not re-show the dialog and will hide it instead
    543544        """
    544         try:
    545             from hashlib import sha1 as sha_hash
    546         except ImportError:
    547             from sha import new as sha_hash
    548 
    549545        classic_mode_was_set = self.gtkui_config["classic_mode"]
    550546
     
    663659        new_gtkui_config["lock_tray"] = \
    664660            self.builder.get_object("chk_lock_tray").get_active()
    665         passhex = sha_hash(self.builder.get_object("txt_tray_password").get_text()).hexdigest()
     661        passhex = sha(self.builder.get_object("txt_tray_password").get_text()).hexdigest()
    666662        if passhex != "c07eb5a8c0dc7bb81c217b67f11c3b7a5e95ffd7":
    667663            new_gtkui_config["tray_password"] = passhex
  • deluge/ui/gtkui/systemtray.py

    rc57220 r4afd1fa  
    438438
    439439    def unlock_tray(self, is_showing_dlg=[False]):
    440         try:
    441             from hashlib import sha1 as sha_hash
    442         except ImportError:
    443             from sha import new as sha_hash
     440        from hashlib import sha1 as sha
    444441
    445442        log.debug("Show tray lock dialog")
     
    489486        def on_response(dialog, response_id):
    490487            if response_id == gtk.RESPONSE_OK:
    491                 if self.config["tray_password"] == sha_hash(entered_pass.get_text()).hexdigest():
     488                if self.config["tray_password"] == sha(entered_pass.get_text()).hexdigest():
    492489                    self.window.present()
    493490
Note: See TracChangeset for help on using the changeset viewer.