projects
/
tahoe-lafs
/
tahoe-lafs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4c9447e
)
added is_uri() function to allmydata.uri
author
robk-tahoe
<robk-tahoe@allmydata.com>
Fri, 11 Jan 2008 03:43:42 +0000
(20:43 -0700)
committer
robk-tahoe
<robk-tahoe@allmydata.com>
Fri, 11 Jan 2008 03:43:42 +0000
(20:43 -0700)
src/allmydata/uri.py
patch
|
blob
|
history
diff --git
a/src/allmydata/uri.py
b/src/allmydata/uri.py
index 66a1874b0e5712d498dc0e8533430ad009e73632..51ebec878f0a7365beacb290f91de8a28c2906ce 100644
(file)
--- 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)