Ticket #858: sugar-858.patch

File sugar-858.patch, 1.9 KB (added by alsroot, 15 years ago)
  • model.py

    diff --git a/model.py b/model.py
    index 7a8e4af..752ef4a 100644
    a b  
    1717#
    1818
    1919import cjson
    20 import sha
     20import hashlib
    2121import gobject
    2222import base64
    2323
    class Model(gobject.GObject): 
    4444                break
    4545       
    4646        self.data['shared_links'].insert(index,
    47                                          {'hash':sha.new(str(url)).hexdigest(),
     47                                         {'hash':hashlib.sha1(str(url)).hexdigest(),
    4848                                          'url':str(url), 'title':str(title),
    4949                                          'thumb':base64.b64encode(thumb),
    5050                                          'owner':str(owner),
  • webactivity.py

    diff --git a/webactivity.py b/webactivity.py
    index a7c55bb..e999c48 100644
    a b import gobject 
    2323gobject.threads_init()
    2424
    2525import gtk
    26 import sha
     26import hashlib
    2727import base64
    2828import time
    2929import shutil
    def _seed_xs_cookie(): 
    8282
    8383    pubkey = profile.get_profile().pubkey
    8484    cookie_data = {'color': profile.get_color().to_string(),
    85                    'pkey_hash': sha.new(pubkey).hexdigest()}
     85                   'pkey_hash': hashlib.sha1(pubkey).hexdigest()}
    8686
    8787    db_path = os.path.join(_profile_path, 'cookies.sqlite')
    8888    try:
    class WebActivity(activity.Activity): 
    464464    def _add_link(self):
    465465        ''' take screenshot and add link info to the model '''
    466466        for link in self.model.data['shared_links']:
    467             if link['hash'] == sha.new(self.current).hexdigest():
     467            if link['hash'] == hashlib.sha1(self.current).hexdigest():
    468468                _logger.debug('_add_link: link exist already a=%s b=%s' %(
    469                     link['hash'], sha.new(self.current).hexdigest()))
     469                    link['hash'], hashlib.sha1(self.current).hexdigest()))
    470470                return
    471471        buf = self._get_screenshot()
    472472        timestamp = time.time()