Groups
Groups
Sign in
Groups
Groups
Genshi
Conversations
About
Send feedback
Help
attrs dictionary from py:match
2 views
Skip to first unread message
mikelin
unread,
Jul 11, 2008, 1:48:00 PM
7/11/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Genshi
Hi, I need to get a dictionary of attributes from an element that I've
matched with a py:match.
Presumably I start with select('@*')?
I looked at AttrsDirective to see how py:attrs does it, but it's
looking pretty complicated. Anyone know an easy way to do this?
Mike
mikelin
unread,
Jul 17, 2008, 11:03:25 AM
7/17/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Genshi
For posterity, I eventually came up with this from looking at
AttrsDirective:
<?python
try:
kind, (tag, attrs), pos = iter(select('//.')).next()
except StopIteration:
attrs = []
attrs = dict(attrs)
?>
Reply all
Reply to author
Forward
0 new messages