Update embed_video_tags.py

Now is possible set relative sizes in template tag. Ex: '100%x500' or '500x100%' or '100%x100%'
This commit is contained in:
Calzzetta 2014-02-23 22:27:06 -03:00 committed by Juda Kaleta
parent 0af959ea02
commit 765d1b2904

View file

@ -48,7 +48,7 @@ class VideoNode(Node):
error_msg = 'Syntax error. Expected: ``{% video URL ... %}``'
default_size = 'small'
re_size = re.compile('(?P<width>\d+)x(?P<height>\d+)')
re_size = re.compile('(?P<width>\w+[%]?)x(?P<height>\w+[%]?)')
def __init__(self, parser, token):
self.size = None
@ -150,7 +150,7 @@ class VideoNode(Node):
try:
size = VideoNode.re_size.match(value)
return [int(size.group('width')), int(size.group('height'))]
return [size.group('width'), size.group('height')]
except AttributeError:
raise TemplateSyntaxError(
'Incorrect size.\nPossible format is WIDTHxHEIGHT or using '