added is_uri() function to allmydata.uri

This commit is contained in:
robk-tahoe 2008-01-10 20:43:42 -07:00
parent 4c9447e258
commit d87a80dca6

View File

@ -434,6 +434,13 @@ def from_string(s):
registerAdapter(from_string, str, IURI)
def is_uri(s):
try:
uri = from_string(s)
return True
except (TypeError, AssertionError):
return False
def from_string_dirnode(s):
u = from_string(s)
assert IDirnodeURI.providedBy(u)