Skip to content

Commit

Permalink
patches to be jython compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Donneker committed Oct 7, 2012
1 parent 037314e commit a8343d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mezzanine/core/templatetags/mezzanine_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
from django.utils.simplejson import loads
from django.utils.text import capfirst

from PIL import Image, ImageFile, ImageOps
# Try to import PIL in either of the two ways it can end up installed. // e.g. no PIL for jython, but maybe compatible libs
try:
from PIL import Image, ImageFile, ImageOps
except ImportError:
import Image, ImageFile, ImageOps

from mezzanine.conf import settings
from mezzanine.core.fields import RichTextField
Expand Down
6 changes: 5 additions & 1 deletion mezzanine/galleries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ def save(self, delete_zip_import=True, *args, **kwargs):
super(Gallery, self).save(*args, **kwargs)
if self.zip_import:
zip_file = ZipFile(self.zip_import)
from PIL import Image
# Try to import PIL in either of the two ways it can end up installed.
try:
from PIL import Image
except ImportError:
import Image
for name in zip_file.namelist():
data = zip_file.read(name)
try:
Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

from __future__ import with_statement
import os
import sys


exclude = ["mezzanine/project_template/dev.db",
Expand Down Expand Up @@ -34,7 +35,12 @@
try:
from PIL import Image, ImageOps
except ImportError:
install_requires += ["pillow"]
try:
import Image, ImageFile, ImageOps
except ImportError:
# no way to install pillow/PIL with jython, so exclude this in any case
if not sys.platform.startswith('java'):
install_requires += ["pillow"]


try:
Expand Down

0 comments on commit a8343d0

Please sign in to comment.