From 528eae7e466eeb4fdbcefc80c45d4b67d86b8ef2 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Fri, 19 Jul 2013 21:26:12 -0500 Subject: [PATCH] minor py3k-compat changes --- pdfparanoia/plugins/aip.py | 4 ++-- pdfparanoia/plugins/ieee.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pdfparanoia/plugins/aip.py b/pdfparanoia/plugins/aip.py index d9d995d..9e93e71 100644 --- a/pdfparanoia/plugins/aip.py +++ b/pdfparanoia/plugins/aip.py @@ -36,7 +36,7 @@ class AmericanInstituteOfPhysics(Plugin): if hasattr(obj, "attrs"): # watermarks tend to be in FlateDecode elements - if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode": + if "Filter" in obj.attrs and str(obj.attrs["Filter"]) == "/FlateDecode": length = obj.attrs["Length"] # the watermark is never very long @@ -45,7 +45,7 @@ class AmericanInstituteOfPhysics(Plugin): data = copy(obj.get_data()) phrase="Redistribution subject to AIP license or copyright" - if phrase in data: + if phrase in str(data): if verbose >= 2: sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data)) elif verbose >= 1: diff --git a/pdfparanoia/plugins/ieee.py b/pdfparanoia/plugins/ieee.py index 0a8691b..4acb9d6 100644 --- a/pdfparanoia/plugins/ieee.py +++ b/pdfparanoia/plugins/ieee.py @@ -33,13 +33,13 @@ class IEEEXplore(Plugin): if hasattr(obj, "attrs"): # watermarks tend to be in FlateDecode elements - if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode": + if "Filter" in obj.attrs and str(obj.attrs["Filter"]) == "/FlateDecode": #length = obj.attrs["Length"] #rawdata = copy(obj.rawdata) data = copy(obj.get_data()) phrase= "Authorized licensed use limited to: " - if phrase in data: + if phrase in str(data): if verbose >= 2: sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data[data.index(phrase):data.index(phrase)+1000])) elif verbose >= 1: