This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Filter should accept width and height args like tag.

Signed-off-by: Eric Florenzano <floguy@gmail.com>
  • Loading branch information...
Nathan Borror authored and ericflo committed Jun 2, 2009
1 parent 1a0cb33 commit bad50953f1ab68bb03017d00cda72d649cf3e11d
Showing with 9 additions and 2 deletions.
  1. +9 −2 oembed/templatetags/oembed_tags.py
@@ -4,8 +4,15 @@
register = template.Library()
-def oembed(input):
- return replace(input)
+def oembed(input, args):
+ if args:
+ width, height = args.lower().split('x')
+ if not width and height:
+ raise template.TemplateSyntaxError("Oembed's optional WIDTHxHEIGH" \
+ "T argument requires WIDTH and HEIGHT to be positive integers.")
+ else:
+ width, height = None, None
+ return replace(input, max_width=width, max_height=height)
oembed.is_safe = True
oembed = stringfilter(oembed)

0 comments on commit bad5095

Please sign in to comment.