Skip to content

Instantly share code, notes, and snippets.

@vojd
vojd / mezzanine_embed.py
Created May 24, 2012 08:52
Allow Youtube embedding in Mezzanines tinyMCE editor
# Allow additional attributes to be saved without be saved through tinyMCE and Mezzanine
# Create a file name defaults.py inside any django app
# Mezzanine will then automatically pick up this file
from mezzanine.conf import register_setting
register_setting(
name="RICHTEXT_ALLOWED_TAGS",
append=True,
default=("iframe", "embed", "object"),
from compressor.filters import CompilerFilter
class CoffeeCompilerFinder(staticfiles.finders.AppDirectoriesFinder):
"""
A quick hacked up staticfiles-finder that will automatically recompile .coffee files to .js and serve the .js file
It will respond to a request for /foo/bar/baz.js and if the coffee-file with the same name in that same dir is newer then
then js-file requested then the js-file will be recompiled.
I did this to not have to manually recompile my scripts or use the watcher and still be compatible with require.js
without have to change the code once i deploy with compiled js-files. it depends on django-compressor at the moment
but if you dont use that its just a small class to lift out from it.