Renamed IKConfig inner class to IKOptions to be consistent and added ImageFile.MAXBLOCK setting

This commit is contained in:
Justin Driscoll 2009-01-12 12:21:12 -05:00
parent 8a0bd9c5a9
commit 82ecb3baef
2 changed files with 7 additions and 4 deletions

View file

@ -6,7 +6,7 @@ Author: Justin Driscoll <justin.driscoll@gmail.com>
Version: 1.0
"""
VERSION = (1, 0)
VERSION = (1, 0, 'pre')

View file

@ -11,13 +11,16 @@ from imagekit.lib import *
from imagekit.options import Options
from imagekit.utils import img_to_fobj
# Modify image file buffer size.
ImageFile.MAXBLOCK = getattr(settings, 'PIL_IMAGEFILE_MAXBLOCK', 256 * 2 ** 10)
class IKModelBase(ModelBase):
def __init__(cls, name, bases, attrs):
parents = [b for b in bases if isinstance(b, IKModelBase)]
if not parents:
return
user_opts = getattr(cls, 'IKConfig', None)
user_opts = getattr(cls, 'IKOptions', None)
opts = Options(user_opts)
try:
module = __import__(opts.spec_module, {}, {}, [''])
@ -36,7 +39,7 @@ class IKModelBase(ModelBase):
class IKModel(models.Model):
""" Abstract base class implementing all core ImageKit functionality
Subclasses of IKModel can override the inner IKConfig class to customize
Subclasses of IKModel can override the inner IKOptions class to customize
storage locations and other options.
"""
@ -45,7 +48,7 @@ class IKModel(models.Model):
class Meta:
abstract = True
class IKConfig:
class IKOptions:
pass
def admin_thumbnail_view(self):