Skip to content

Commit

Permalink
Merge pull request #50 from plone/jensens-fix-logging
Browse files Browse the repository at this point in the history
reduce logging level
  • Loading branch information
rnixx authored May 19, 2017
2 parents 4cc9df3 + 8944f61 commit 4854127
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Bug fixes:
- Fix bug on Image rotation if ImageIFD.XResolution or ImageIFD.YResolution are not set.
[loechel]

- Fix: Do not log failing PIL image regognition as error, but as warning.
[jensens]


4.2.0 (2017-03-26)
------------------
Expand Down
9 changes: 6 additions & 3 deletions plone/namedfile/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ def getImageInfo(data):
img = PIL.Image.open(StringIO(data))
width, height = img.size
content_type = img.format
except Exception as e:
except Exception:
# TODO: determ wich error really happens
# Should happen if data is to short --> first_bytes
log.error(e)
# return 'image/jpeg', -1, -1
# happens also if data is an svg or another special format.
log.warn(
'PIL can not recognize the image. '
'Image is probably broken or of a non-supported format.'
)

log.debug('Image Info (Type: %s, Width: %s, Height: %s)',
content_type, width, height)
Expand Down

1 comment on commit 4854127

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnixx Jenkins CI reporting about code analysis
See the full report here: http://jenkins.plone.org/job/package-plone.namedfile/29/violations

plone/namedfile/testing.py:18:9: D001 found xmlconfig.file( replace it with self.loadZCML(
plone/namedfile/scaling.py:194:1: C901 'DefaultImageScalingFactory.__call__' is too complex (15)
plone/namedfile/utils/__init__.py:182:1: C901 'rotate_image' is too complex (20)
plone/namedfile/utils/tiff_utils.py:12:1: C901 'process_tiff' is too complex (11)

Follow these instructions to reproduce it locally.

Please sign in to comment.