Edgewall Software

Changes between Initial Version and Version 1 of Ticket #296


Ignore:
Timestamp:
Mar 12, 2009 9:14:08 AM (6 years ago)
Author:
cmlenz
Comment:

(add some formatting to the description)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #296 – Description

    initial v1  
    11Currently to generate elements from a list some hackery is needed, ie:
    22
     3{{{
     4#!genshi
    35<?python from genshi.builder import tag ?><py:for each='field in fields'>${getattr(tag,field)}</py:for>
     6}}}
    47
    58It would be cleaner if we could instead:
     9
     10{{{
     11#!genshi
    612<py:for each='field in fields'><py:element name="field"/></py:for>
     13}}}
    714
    8 py:attrs should be applied second such that:
     15`py:attrs` should be applied second such that:
    916
     17{{{
     18#!genshi
    1019<py:for each='field in fields'><py:element name='field' py:attrs='fields[field]'/></py:for>
    11 
     20}}}
    1221It would be useful if the element name could contain the namespace, ie:
    1322
     23{{{
     24#!python
    1425fields = {'greek:alpha' : {'value' : 1, 'xmlns:greek' = 'xml:foo:greek'},
    1526          'game:monsters' : {'hp' : 552, 'label' : 'Queen Banshee'}}
     27}}}
    1628
    1729In XMPP there are many cases where it'd be useful for generated elements to be in different namespaces like this.  A separate py:element namespace= attribute may also be useful in some situations but would increase complexity in the above examples.