Edgewall Software

Opened 15 years ago

Last modified 7 years ago

#296 new enhancement

py:element directive — at Initial Version

Reported by: Arc Riley <arcriley@…> Owned by: cmlenz
Priority: minor Milestone: 0.9
Component: Template processing Version: 0.5.1
Keywords: Cc:

Description

Currently to generate elements from a list some hackery is needed, ie:

<?python from genshi.builder import tag ?><py:for each='field in fields'>${getattr(tag,field)}</py:for>

It would be cleaner if we could instead: <py:for each='field in fields'><py:element name="field"/></py:for>

py:attrs should be applied second such that:

<py:for each='field in fields'><py:element name='field' py:attrs='fields[field]'/></py:for>

It would be useful if the element name could contain the namespace, ie:

fields = {'greek:alpha' : {'value' : 1, 'xmlns:greek' = 'xml:foo:greek'},

'game:monsters' : {'hp' : 552, 'label' : 'Queen Banshee'}}

In 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.

Change History (0)

Note: See TracTickets for help on using tickets.