Skip to content

Commit

Permalink
Merge pull request #27 from collective/tomgross-smallfixtures
Browse files Browse the repository at this point in the history
correctly check for plone.namedfile
  • Loading branch information
petschki committed Aug 26, 2013
2 parents 1169d3d + 5fedcb2 commit 093639c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Expand Up @@ -4,7 +4,8 @@ Changelog
0.1rc3 (unreleased)
-------------------

- Nothing changed yet.
- Check for plone.namedfile not Dexterity. It can be used seperately
[tom_gross]


0.1rc2 (2013-05-03)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -8,6 +8,7 @@
- Daniel Widerin (saily)
- Wolfgang Thomas (pysailor)
- Héctor Velarde (hvelarde)
- Tom Gross (tom_gross)

Credits
-------
Expand Down
9 changes: 6 additions & 3 deletions src/plone/app/imagecropping/__init__.py
Expand Up @@ -2,11 +2,14 @@
import pkg_resources

try:
pkg_resources.get_distribution('plone.dexterity')
pkg_resources.get_distribution('plone.namedfile')
except pkg_resources.DistributionNotFound:
HAS_DEXTERITY = False
HAS_NAMEDFILE = False
else:
HAS_DEXTERITY = True
HAS_NAMEDFILE = True

# TODO: backwards compatibility (probably not needed)
HAS_DEXTERITY = HAS_NAMEDFILE

imagecroppingMessageFactory = MessageFactory("plone.app.imagecropping")
PRODUCT_NAME = PAI_STORAGE_KEY = "plone.app.imagecropping"
Expand Down
6 changes: 3 additions & 3 deletions src/plone/app/imagecropping/utils.py
Expand Up @@ -16,8 +16,8 @@

import time

from plone.app.imagecropping import HAS_DEXTERITY
if HAS_DEXTERITY:
from plone.app.imagecropping import HAS_NAMEDFILE
if HAS_NAMEDFILE:
from plone.namedfile.interfaces import IImage
from plone.namedfile.interfaces import IImageScaleTraversable

Expand Down Expand Up @@ -108,7 +108,7 @@ def crop_factory(fieldname, direction='keep', **parameters):
storage.scale(
factory=crop_factory, fieldname=field.__name__, width=w, height=h)

if HAS_DEXTERITY:
if HAS_NAMEDFILE:
class CroppingUtilsDexterity(BaseUtil):
"""TODO"""

Expand Down

0 comments on commit 093639c

Please sign in to comment.