Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 9 by n.leush: Save and remove signals doesn't take to account
template sites
http://code.google.com/p/django-dbtemplates/issues/detail?id=9
When signal works - template is cached to current site, not for sites of
template.
Here is how i solved this. It's ugly... but works. I think maybe cache
backend should accept whole template object to do this work incapsulated.
def add_template_to_cache(instance, **kwargs):
"""
Called via Django's signals to cache the templates, if the template
in the database was added or changed.
"""
SITE_ID = settings.SITE_ID
for site in instance.sites.all():
settings.SITE_ID = site.pk
backend.save(instance.name, instance.content)
settings.SITE_ID = SITE_ID
def remove_cached_template(instance, **kwargs):
"""
Called via Django's signals to remove cached templates, if the template
in the database was changed or deleted.
"""
SITE_ID = settings.SITE_ID
for site in instance.sites.all():
settings.SITE_ID = site.pk
backend.remove(instance.name)
settings.SITE_ID = SITE_ID
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---