Mercurial > genshi > genshi-test
comparison markup/template.py @ 48:06c642ba2b08
convert the result of expressions in attributes to strings so that values like ints are output correctly
author | mgood |
---|---|
date | Tue, 04 Jul 2006 04:49:22 +0000 |
parents | 42bcb91bf025 |
children | a053ffb834cb |
comparison
equal
deleted
inserted
replaced
47:04bb078c6234 | 48:06c642ba2b08 |
---|---|
31 | 31 |
32 Todo items: | 32 Todo items: |
33 * Improved error reporting | 33 * Improved error reporting |
34 * Support for using directives as elements and not just as attributes, reducing | 34 * Support for using directives as elements and not just as attributes, reducing |
35 the need for wrapper elements with py:strip="" | 35 the need for wrapper elements with py:strip="" |
36 * Support for py:choose/py:when/py:otherwise (similar to XSLT) | |
37 * Support for list comprehensions and generator expressions in expressions | 36 * Support for list comprehensions and generator expressions in expressions |
38 | 37 |
39 Random thoughts: | 38 Random thoughts: |
40 * Is there any need to support py:extends and/or py:layout? | 39 * Is there any need to support py:extends and/or py:layout? |
41 * Could we generate byte code from expressions? | 40 * Could we generate byte code from expressions? |
802 for subkind, subdata, subpos in substream: | 801 for subkind, subdata, subpos in substream: |
803 if subkind is Template.EXPR: | 802 if subkind is Template.EXPR: |
804 values.append(subdata.evaluate(ctxt)) | 803 values.append(subdata.evaluate(ctxt)) |
805 else: | 804 else: |
806 values.append(subdata) | 805 values.append(subdata) |
807 value = filter(lambda x: x is not None, values) | 806 value = [unicode(x) for x in values if x is not None] |
808 if not value: | 807 if not value: |
809 continue | 808 continue |
810 new_attrib.append((name, u''.join(value))) | 809 new_attrib.append((name, u''.join(value))) |
811 yield kind, (tag, Attributes(new_attrib)), pos | 810 yield kind, (tag, Attributes(new_attrib)), pos |
812 | 811 |