Mercurial > genshi > genshi-test
comparison genshi/builder.py @ 403:32b283e1d310
Remove some magic/overhead from `Attrs` creation and manipulation by not automatically wrapping attribute names in `QName`.
author | cmlenz |
---|---|
date | Wed, 21 Feb 2007 09:51:43 +0000 |
parents | d8c5045b547a |
children | 49a3bae5a8bb |
comparison
equal
deleted
inserted
replaced
402:cc7f5b3fbbed | 403:32b283e1d310 |
---|---|
80 if isinstance(value, unicode): | 80 if isinstance(value, unicode): |
81 return value | 81 return value |
82 return unicode(value) | 82 return unicode(value) |
83 | 83 |
84 def _kwargs_to_attrs(kwargs): | 84 def _kwargs_to_attrs(kwargs): |
85 return [(k.rstrip('_').replace('_', '-'), _value_to_unicode(v)) | 85 return [(QName(k.rstrip('_').replace('_', '-')), _value_to_unicode(v)) |
86 for k, v in kwargs.items() if v is not None] | 86 for k, v in kwargs.items() if v is not None] |
87 | 87 |
88 | 88 |
89 class Element(Fragment): | 89 class Element(Fragment): |
90 """Simple XML output generator based on the builder pattern. | 90 """Simple XML output generator based on the builder pattern. |