Changes between and of Version 3Version 4Ticket #6275


Ignore:
Timestamp:
01/22/13 22:52:41 (9 years ago)
Author:
Jean-Paul Calderone
Comment:

This is easier still.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6275 – Description

    v3 v4  
    11{{{
    22#!python
    3 >>> s = ("""
    4 ... <a xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
    5 ... <t:attr name="href">" class="foobar</t:attr>
    6 ... </a>
    7 ... """)
    8 >>> class ExampleElement(template.Element):
    9 ...     loader = template.XMLString(s)
    10 ...
    11 >>> def renderDone(output):
    12 ...     print output
    13 ...
    14 >>> template.flattenString(None, ExampleElement()).addCallback(renderDone)
     3from twisted.web import template
     4
     5s = ("""
     6<a xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
     7<t:attr name="href">" class="foobar</t:attr>
     8</a>
     9""")
     10class ExampleElement(template.Element):
     11    loader = template.XMLString(s)
     12
     13def renderDone(output):
     14    print output
     15
     16template.flattenString(
     17    None, ExampleElement()).addCallback(renderDone)
     18}}}
     19
     20The result is:
     21
     22{{{
    1523<a href="" class="foobar"></a>
    1624}}}