Skip to content

Commit

Permalink
Removed colon from ALLOWED_NAME_CHARS as including it resulted in URN…
Browse files Browse the repository at this point in the history
… identifiers not getting split at all and thus leading to compute_qname being unable to compute the qnames of URNs. This change did not break any current tests, and allowed the previously added 2 tests to pass (note: as a quick fix is_cname already excludes colon from ALLOWED_NAME_CHARS as it causes issues there too #663 , so as far as I can tell there really is no reason for colon to be included)
  • Loading branch information
namcsi committed Mar 8, 2021
1 parent 843be47 commit 7cdd668
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rdflib/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def absolutize(self, uri, defrag=1):
NAME_START_CATEGORIES = ["Ll", "Lu", "Lo", "Lt", "Nl"]
SPLIT_START_CATEGORIES = NAME_START_CATEGORIES + ["Nd"]
NAME_CATEGORIES = NAME_START_CATEGORIES + ["Mc", "Me", "Mn", "Lm", "Nd"]
ALLOWED_NAME_CHARS = ["\u00B7", "\u0387", "-", ".", "_", ":", "%"]
ALLOWED_NAME_CHARS = ["\u00B7", "\u0387", "-", ".", "_", "%"]


# http://www.w3.org/TR/REC-xml-names/#NT-NCName
Expand All @@ -914,7 +914,7 @@ def is_ncname(name):
for i in range(1, len(name)):
c = name[i]
if not category(c) in NAME_CATEGORIES:
if c != ":" and c in ALLOWED_NAME_CHARS:
if c in ALLOWED_NAME_CHARS:
continue
return 0
# if in compatibility area
Expand Down

0 comments on commit 7cdd668

Please sign in to comment.