From: robk-tahoe Date: Fri, 11 Jan 2008 03:43:42 +0000 (-0700) Subject: added is_uri() function to allmydata.uri X-Git-Url: https://git.rkrishnan.org/nxhtml.html?a=commitdiff_plain;h=d87a80dca6fd8408df6de4b6092f86dbe248aaf5;p=tahoe-lafs%2Ftahoe-lafs.git added is_uri() function to allmydata.uri --- diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 66a1874b..51ebec87 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -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)