Skip to content

Commit

Permalink
explicit casting to str before using string ops such as startswith
Browse files Browse the repository at this point in the history
  • Loading branch information
joernhees committed Feb 15, 2016
1 parent 479b856 commit 85227db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rdflib/plugins/serializers/xmlwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def text(self, text):
def qname(self, uri):
"""Compute qname for a uri using our extra namespaces,
or the given namespace manager"""

for pre, ns in self.extra_ns.items():
ns = str(ns)
if uri.startswith(ns):
if pre != "":
return ":".join(pre, uri[len(ns):])
Expand Down
2 changes: 1 addition & 1 deletion rdflib/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def serialize(self, stream, base=None, encoding=None, **args):
"""Abstract method"""

def relativize(self, uri):
base = self.base
base = str(self.base)
if base is not None and uri.startswith(base):
uri = URIRef(uri.replace(base, "", 1))
return uri

0 comments on commit 85227db

Please sign in to comment.