In many situations, it is preferable to hobble along (or even make only passing notice) when errors occur rather than blowing up the rendering completely.
My particular case is templates which are created by non-technical users in inkscape. I have found over the last year or so that clear but self-contained effects are desirable in this role.
I do have a continuing issue though, where iteration occasionally trips over the concat implementation in utils; runtime contains a suitable replacement (unicode_join becomes the initial _concat implementation instead of u"".join), but an alternative would be for LaxUndefined to inherit from unicode instead of Undefined, and registering itself on Undefined's new metaclass. I'm not sure which you would find more palatable.
Give Undefined an ABCMeta metaclass, which allows reimplementations o…
…f Undefined to appear to inherit from Undefined, while not actually subclassing it. This removes the restrictions that including a __slots__ member introduces.
Add LaxUndefined, which takes the null-object pattern to the most con…
Nearly all operations that would raise an exception under Defined will return self instead, while still preserving the original hint data, which is delivered in the object's repr.
Edited jinja2/__init__.py via GitHub
The abc module was added in Python 2.6. But jinja2 is compatible with Python 2.4. So you have to add a fallback for the case that importing abc fails.
Not sure what the reason for the metaclass is exactly. Why does it have to be an ABC?
Ideally this can just stay in user's code.