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. Serialize a model instance by chriswedgwood 1 week, 1 day ago
  2. Automatically setup raw_id_fields ForeignKey & OneToOneField by agusmakmun 9 months, 1 week ago
  3. Crispy Form by sourabhsinha396 10 months ago
  4. ReadOnlySelect by mkoistinen 10 months, 2 weeks ago
  5. Verify events sent to your webhook endpoints by santos22 11 months, 2 weeks 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.