From 1bcfba3fcddc88b15910db1f9252acbaf3c4119a Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 24 Oct 2010 21:54:29 +0200 Subject: Switched from deprecated pyxattr calls and decode bytes object from list and get calls. --- pyanidb/hash.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyanidb/hash.py b/pyanidb/hash.py index 489f15a..1df7e08 100644 --- a/pyanidb/hash.py +++ b/pyanidb/hash.py @@ -77,7 +77,7 @@ class File: def read_cache(self): if not xattr: return - cache = dict([(n[13:], xattr.getxattr(self.name, n)) for n in xattr.listxattr(self.name) if n.startswith('user.pyanidb.')]) + cache = dict([(n[13:], xattr.get(self.name, n)) for n in xattr.list(self.name) if n.decode().startswith('user.pyanidb.')]) if 'mtime' not in cache or str(int(self.mtime)) != cache.pop('mtime'): return for n, v in cache.items(): @@ -89,17 +89,17 @@ class File: return try: self.clear_cache() - xattr.setxattr(self.name, 'user.pyanidb.mtime', str(int(self.mtime))) + xattr.set(self.name, 'user.pyanidb.mtime', str(int(self.mtime))) for n in ('ed2k', 'md5', 'sha1', 'crc32'): if hasattr(self, n): - xattr.setxattr(self.name, 'user.pyanidb.' + n, getattr(self, n)) + xattr.set(self.name, 'user.pyanidb.' + n, getattr(self, n)) except IOError: pass def clear_cache(self): - for name in xattr.listxattr(self.name): - if name.startswith('user.pyanidb.'): - xattr.removexattr(self.name, name) + for name in xattr.list(self.name): + if name.decode().startswith('user.pyanidb.'): + xattr.remove(self.name, name) class Hashthread(threading.Thread): def __init__(self, filelist, hashlist, algorithms, cache, *args, **kwargs): -- cgit v1.2.3