Skip to content

Commit

Permalink
Merge pull request #45 from plone/issue_38_master
Browse files Browse the repository at this point in the history
Issue 38 master
  • Loading branch information
thet authored Apr 25, 2017
2 parents fe03180 + 98239b9 commit d7fcec3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ New features:

Bug fixes:

- Fix contentType attribute should be str type, what leads to validation errors (fixes `#38`_).
[rodfersou]

- Fix bug on Image rotation if ImageIFD.XResolution or ImageIFD.YResolution are not set.
[loechel]

Expand Down Expand Up @@ -461,3 +464,6 @@ Fixes:
------------------

* Initial release


.. _`#38`: https://github.com/plone/plone.namedfile/issues/38
2 changes: 1 addition & 1 deletion plone/namedfile/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def __call__(
return

data, format_, dimensions = result
mimetype = u'image/{0}'.format(format_.lower())
mimetype = 'image/{0}'.format(format_.lower())
value = orig_value.__class__(
data,
contentType=mimetype,
Expand Down
6 changes: 6 additions & 0 deletions plone/namedfile/tests/test_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def testCreateScale(self):
foo = self.scaling.scale('image', width=100, height=80)
self.assertTrue(foo.uid)
self.assertEqual(foo.mimetype, 'image/png')
self.assertIsInstance(foo.mimetype, str)
self.assertEqual(foo.data.contentType, 'image/png')
self.assertIsInstance(foo.data.contentType, str)
self.assertEqual(foo.width, 80)
self.assertEqual(foo.height, 80)
assertImage(self, foo.data.data, 'PNG', (80, 80))
Expand Down Expand Up @@ -105,6 +108,9 @@ def testGetScaleByName(self):
foo = self.scaling.scale('image', scale='foo')
self.assertTrue(foo.uid)
self.assertEqual(foo.mimetype, 'image/png')
self.assertIsInstance(foo.mimetype, str)
self.assertEqual(foo.data.contentType, 'image/png')
self.assertIsInstance(foo.data.contentType, str)
self.assertEqual(foo.width, 60)
self.assertEqual(foo.height, 60)
assertImage(self, foo.data.data, 'PNG', (60, 60))
Expand Down

2 comments on commit d7fcec3

@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.

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

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

Follow these instructions to reproduce it locally.

@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.

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

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

Follow these instructions to reproduce it locally.

Please sign in to comment.