Merge branch 'release/0.3.4'

* release/0.3.4:
  Adding distutils stuff to .gitignore.
  Bumping internal version to 0.3.4.
  patch applied badly, fixing if
  if the ImageField is null and not required, don't create
  Fleshing out setup.py. Adding MANIFEST.in.
This commit is contained in:
Bryan Veloso 2011-02-11 12:59:46 -08:00
commit 851404dee9
5 changed files with 44 additions and 34 deletions

5
.gitignore vendored
View file

@ -1,4 +1,7 @@
*.pyc
*.db
*.orig
.DS_Store
.DS_Store
dist
build
MANIFEST

2
MANIFEST.in Normal file
View file

@ -0,0 +1,2 @@
include AUTHORS
include LICENSE

View file

@ -1,10 +1,11 @@
"""
Django ImageKit
Author: Justin Driscoll <justin.driscoll@gmail.com>
Version: 0.3.3
Version: 0.3.4
"""
VERSION = "0.3.3"
__author__ = 'Justin Driscoll, Bryan Veloso, Greg Newman, Chris Drackett'
__version__ = (0, 3, 4)

View file

@ -51,19 +51,20 @@ class Accessor(object):
return imgfile
def _create(self):
if self._exists():
return
# process the original image file
try:
fp = self._obj._imgfield.storage.open(self._obj._imgfield.name)
except IOError:
return
fp.seek(0)
fp = StringIO(fp.read())
self._img, self._fmt = self.spec.process(Image.open(fp), self._obj)
# save the new image to the cache
content = ContentFile(self._get_imgfile().read())
self._obj._storage.save(self.name, content)
if self._obj._imgfield:
if self._exists():
return
# process the original image file
try:
fp = self._obj._imgfield.storage.open(self._obj._imgfield.name)
except IOError:
return
fp.seek(0)
fp = StringIO(fp.read())
self._img, self._fmt = self.spec.process(Image.open(fp), self._obj)
# save the new image to the cache
content = ContentFile(self._get_imgfile().read())
self._obj._storage.save(self.name, content)
def _delete(self):
self._obj._storage.delete(self.name)
@ -73,21 +74,22 @@ class Accessor(object):
@property
def name(self):
filepath, basename = os.path.split(self._obj._imgfield.name)
filename, extension = os.path.splitext(basename)
for processor in self.spec.processors:
if issubclass(processor, processors.Format):
extension = processor.extension
cache_filename = self._obj._ik.cache_filename_format % \
{'filename': filename,
'specname': self.spec.name(),
'extension': extension.lstrip('.')}
if callable(self._obj._ik.cache_dir):
return self._obj._ik.cache_dir(self._obj, filepath,
cache_filename)
else:
return os.path.join(self._obj._ik.cache_dir, filepath,
cache_filename)
if self._obj._imgfield.name:
filepath, basename = os.path.split(self._obj._imgfield.name)
filename, extension = os.path.splitext(basename)
for processor in self.spec.processors:
if issubclass(processor, processors.Format):
extension = processor.extension
cache_filename = self._obj._ik.cache_filename_format % \
{'filename': filename,
'specname': self.spec.name(),
'extension': extension.lstrip('.')}
if callable(self._obj._ik.cache_dir):
return self._obj._ik.cache_dir(self._obj, filepath,
cache_filename)
else:
return os.path.join(self._obj._ik.cache_dir, filepath,
cache_filename)
@property
def url(self):

View file

@ -9,7 +9,9 @@ setup(
author_email='justin@driscolldev.com',
url='http://github.com/jdriscoll/django-imagekit/',
packages=[
'imagekit'
'imagekit',
'imagekit.management',
'imagekit.management.commands'
],
classifiers=[
'Development Status :: 3 - Alpha',