Skip to content

Commit

Permalink
Merge pull request #16 from redapple/py3
Browse files Browse the repository at this point in the history
Improve Python 3 compatibility
  • Loading branch information
iherman committed Dec 15, 2016
2 parents 3284022 + ab20d48 commit 94aead9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pyRdfa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def _get_input(self, name) :
return name
except HTTPError :
raise sys.exc_info()[1]
except RDFaError, e :
except RDFaError as e :
raise e
except :
(type, value, traceback) = sys.exc_info()
Expand Down Expand Up @@ -555,7 +555,7 @@ def copyErrors(tog, options) :
for k,ns in options.processor_graph.graph.namespaces() :
tog.bind(k,ns)
if pgraph != None : pgraph.bind(k,ns)
options.reset_processor_graph()
options.reset_processor_graph()
return tog

# Separating this for a forward Python 3 compatibility
Expand All @@ -571,7 +571,7 @@ def copyErrors(tog, options) :
input = None
try :
input = self._get_input(name)
except FailedSource,ex :
except FailedSource as ex :
f = sys.exc_info()[1]
self.http_status = 400
if not rdfOutput : raise f
Expand All @@ -585,7 +585,7 @@ def copyErrors(tog, options) :
err = self.options.add_error("HTTP Error: %s (%s)" % (h.http_code,h.msg), HTError, name)
self.options.processor_graph.add_http_context(err, h.http_code)
return copyErrors(graph, self.options)
except RDFaError, ex:
except RDFaError as ex:
e = sys.exc_info()[1]
self.http_status = 500
# Something nasty happened:-(
Expand Down
3 changes: 1 addition & 2 deletions pyRdfa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from rdflib.RDF import RDFNS as ns_rdf

from .host import HostLanguage, preferred_suffixes
from types import *

#########################################################################################################
# Handling URIs
Expand Down Expand Up @@ -188,7 +187,7 @@ def has_one_of_attributes(node,*args) :
"""
if len(args) == 0 :
return None
if isinstance(args[0], TupleType) or isinstance(args[0],ListType) :
if isinstance(args[0], tuple) or isinstance(args[0], list) :
rargs = args[0]
else :
rargs = args
Expand Down

0 comments on commit 94aead9

Please sign in to comment.