Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
2437154c
Commit
2437154c
authored
Sep 26, 2016
by
Liam Brenner
Browse files
Do a type check for jinja2 tag
parent
c28cc1bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/jinja2tags.py
View file @
2437154c
from
__future__
import
absolute_import
,
unicode_literals
from
__future__
import
absolute_import
,
unicode_literals
import
mimetypes
from
jinja2.ext
import
Extension
from
jinja2.ext
import
Extension
from
django
import
template
from
.models
import
Video
from
django.forms.widgets
import
flatatt
from
django.utils.text
import
mark_safe
def
video
(
video
,
attrs
):
if
not
video
:
return
''
if
attrs
:
def
video
(
video
,
attrs
=
'preload controls'
)
:
return
video
.
video_tag
(
attrs
)
if
type
(
video
)
!=
Video
:
else
:
raise
TypeError
(
'Expected type {0}, received {1}.'
.
format
(
Video
,
type
(
video
)))
return
video
return
video
.
video_tag
(
attrs
)
class
WagtailVideosExtension
(
Extension
):
class
WagtailVideosExtension
(
Extension
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment