summaryrefslogtreecommitdiff
path: root/lib/sexp/access.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-16 16:07:40 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-16 16:07:40 +0000
commitddc03061218dc00a664aaf10a6a2fec2b604deac (patch)
tree4cb3bc48ed2bc1542c82c7711133c99c7c285368 /lib/sexp/access.py
parent96516246c3a3cdebf149977b52e14a919b401a33 (diff)
More glider hacks: implement public keys.
git-svn-id: file:///home/or/svnrepo/updater/trunk@16917 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib/sexp/access.py')
-rw-r--r--lib/sexp/access.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sexp/access.py b/lib/sexp/access.py
index beb87c9..c5182f0 100644
--- a/lib/sexp/access.py
+++ b/lib/sexp/access.py
@@ -36,6 +36,16 @@ def s_child(s, tag):
return child
return None
+def s_attr(s, tag):
+ """Returns the second element of the child of 's' whose tag is 'tag'.
+ This is helpful for extracting a (key val) element. Returns None
+ if there is no such element.
+ """
+ ch = s_child(s,tag)
+ if ch == None or len(ch) < 2:
+ return None
+ return ch[1]
+
def s_children(s, tag):
"""Returns a generator yielding all children of 's' whose tag is 'tag'.