Use hashlib on python 2.5

This commit is contained in:
Dan Williams 2007-04-26 12:34:05 -04:00
parent 1c249a216b
commit 274cc65c4e

View File

@ -23,7 +23,8 @@ import gtk
from buddyiconcache import BuddyIconCache from buddyiconcache import BuddyIconCache
import logging import logging
import os import os
import md5
import sys
import psutils import psutils
from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel
@ -343,7 +344,14 @@ class ServerPlugin(gobject.GObject):
if not icon_data: if not icon_data:
icon_data = self._owner.props.icon icon_data = self._owner.props.icon
m = md5.new() m = None
if sys.version_info[:3] >= (2, 5, 0):
import hashlib
m = hashlib.md5()
else:
import md5
m = md5.new()
m.update(icon_data) m.update(icon_data)
hash = m.hexdigest() hash = m.hexdigest()