2012-03-06 12:16:03 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django.dispatch import Signal
|
|
|
|
|
2013-12-09 23:56:01 +01:00
|
|
|
|
|
|
|
class TemplateManipulationSignal(Signal):
|
|
|
|
"""
|
|
|
|
Derived class to ensure that the key extra_stylefiles and extra_javascript
|
|
|
|
exist in the context dictionary.
|
|
|
|
"""
|
|
|
|
def send(self, **kwargs):
|
|
|
|
kwargs['context'].setdefault('extra_stylefiles', [])
|
|
|
|
kwargs['context'].setdefault('extra_javascript', [])
|
|
|
|
return super(TemplateManipulationSignal, self).send(**kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
template_manipulation = TemplateManipulationSignal(providing_args=['request', 'context'])
|