summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@surroundaustralia.com>2021-03-05 21:27:30 +1000
committerGitHub <noreply@github.com>2021-03-05 21:27:30 +1000
commitb41560f4c5f5cbf1424d24492ee15c28f65fa197 (patch)
tree59de39b2cb80c0ff54c1893898243a72525d4adb
parent9f0f296a3b36cbca9771cd0f0c25492a06a33acd (diff)
parent4276aa79d6d6c2cc0c5032f0a2703042aa778623 (diff)
downloadrdflib-b41560f4c5f5cbf1424d24492ee15c28f65fa197.tar.gz
Merge pull request #1070 from abhishekvickyvyas/master
issue_771_add_key_error_if_spaces
-rw-r--r--rdflib/namespace.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rdflib/namespace.py b/rdflib/namespace.py
index fc7985fa..8228a0e0 100644
--- a/rdflib/namespace.py
+++ b/rdflib/namespace.py
@@ -798,6 +798,9 @@ class NamespaceManager(object):
# When documenting explain that override only applies in what cases
if prefix is None:
prefix = ""
+ elif " " in prefix:
+ raise KeyError("Prefixes may not contain spaces.")
+
bound_namespace = self.store.namespace(prefix)
# Check if the bound_namespace contains a URI
# and if so convert it into a URIRef for comparison