Edgewall Software

Opened 13 years ago

Last modified 8 years ago

#431 new enhancement

Add py:else directive

Reported by: hodgestar Owned by: hodgestar
Priority: major Milestone: 0.9
Component: Template processing Version: 0.6
Keywords: Cc:

Description

On the Genshi mailing list Eoghan Murray suggested the addition of a py:else directive that is nested inside the py:if directive and is an alternative to py:choose for simple binary output choices.

E.g.

>>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/"
...   py:if="False">
...   Will not be output
...   <py:else>Will be output</py:else>
... </div>''')
>>> print(tmpl.generate())
<div>
  Will be output
</div>

Attachments (1)

py-else-r1162.diff (4.4 KB) - added by hodgestar 13 years ago.
Initial outline of implementation (from Eoghan's email with a little clean up by me).

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by hodgestar

Initial outline of implementation (from Eoghan's email with a little clean up by me).

comment:1 Changed 13 years ago by hodgestar

A few things are needed before this can go in:

  • Tests for all the common cases.
  • Double-check whether any further documentation updates are needed.
  • The current implementation omits the element with the py:if attribute when handling the py:else case. I'm not sure whether this is right or not (I can imagine use cases that for both options).

comment:2 Changed 8 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

Note: See TracTickets for help on using tickets.