Skip to content

Instantly share code, notes, and snippets.

View matthewwithanm's full-sized avatar

Matthew Dapena-Tretter matthewwithanm

View GitHub Profile
@matthewwithanm
matthewwithanm / async.py
Created February 11, 2012 05:55
Cache State Backend
# -*- coding: utf-8 -*-
from celery.task import task
from imagekit.cachestate import PessimisticCacheStateBackend
@task
def generate(model, pk, attr):
try:
instance = model._default_manager.get(pk=pk)
except model.DoesNotExist: