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. "Magic Link" Management Command by webology 1 month ago
  2. Closest ORM models to a latitude/longitude point by simonw 1 month ago
  3. Log the time taken to execute each DB query by kennyx46 1 month ago
  4. django database snippet by ItsRLuo 1 month ago
  5. Serialize a model instance by chriswedgwood 2 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.