From d87a80dca6fd8408df6de4b6092f86dbe248aaf5 Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Thu, 10 Jan 2008 20:43:42 -0700 Subject: [PATCH] added is_uri() function to allmydata.uri --- src/allmydata/uri.py | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.45.2