1 2 3 4 5 6 7 | @register.filter
def smartypants(value):
try:
import smartypants
return smartypants.smartyPants(value)
except:
return value
|
More like this
- Really simple locking by sirex 2 years, 4 months ago
- Avoid widows using a template filter by jcroft 6 years, 3 months ago
- Wrappable text by jdunck 3 years, 8 months ago
- Pygmentify a code using template filter by tamizhgeek 2 years, 1 month ago
- Simple template tag to do |stringformat filter with format from a variable by leopd 2 years, 2 months ago
Comments
An "except ImportError" would be better form there, assuming that the intent of the bare except is to handle cases where smartypants is not available.
#