Login

SmartyPants Filter

Author:
obeattie
Posted:
April 17, 2007
Language:
Python
Version:
.96
Tags:
filter typography smartypants
Score:
1 (after 1 ratings)

Really simple filter for using Smartpants in your template -- placed in your custom filters file. Requires python smartypants to be installed.

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

  1. Changelist filter by ForeignKey by overclocked 4 years, 8 months ago
  2. Filter by taggit tags in the admin by flupke 3 years, 9 months ago
  3. linebreaksli template filter by rokclimb15 8 years, 1 month ago
  4. Use MEDIA_URL in flatpages by robhudson 7 years, 4 months ago
  5. math filter by itchyfingrs 4 years, 3 months ago

Comments

pbx (on May 5, 2007):

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.

#

Please login first before commenting.