mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Add warnings to deprecated CMS profile attributes
This commit is contained in:
parent
a149c13d2e
commit
e1381d2102
|
@ -371,8 +371,13 @@ class TestImageCms(PillowTestCase):
|
||||||
self.assertEqual(result, 'XYZ')
|
self.assertEqual(result, 'XYZ')
|
||||||
|
|
||||||
self.assertIsNone(p.perceptual_rendering_intent_gamut)
|
self.assertIsNone(p.perceptual_rendering_intent_gamut)
|
||||||
self.assertEqual(p.product_copyright,
|
|
||||||
'Copyright International Color Consortium, 2009')
|
# p.product_copyright
|
||||||
|
result = self.assert_warning(
|
||||||
|
DeprecationWarning, getattr, p, "product_copyright"
|
||||||
|
)
|
||||||
|
self.assertEqual(result, "Copyright International Color Consortium, 2009")
|
||||||
|
|
||||||
self.assertEqual(p.product_desc, 'sRGB IEC61966-2-1 black scaled')
|
self.assertEqual(p.product_desc, 'sRGB IEC61966-2-1 black scaled')
|
||||||
self.assertEqual(p.product_description,
|
self.assertEqual(p.product_description,
|
||||||
'sRGB IEC61966-2-1 black scaled')
|
'sRGB IEC61966-2-1 black scaled')
|
||||||
|
|
|
@ -728,7 +728,7 @@ def getProfileInfo(profile):
|
||||||
# so skipping.
|
# so skipping.
|
||||||
# info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint
|
# info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint
|
||||||
description = profile.profile.product_description
|
description = profile.profile.product_description
|
||||||
cpright = profile.profile.product_copyright
|
cpright = profile.profile.copyright
|
||||||
arr = []
|
arr = []
|
||||||
for elt in (description, cpright):
|
for elt in (description, cpright):
|
||||||
if elt:
|
if elt:
|
||||||
|
@ -762,7 +762,7 @@ def getProfileCopyright(profile):
|
||||||
# add an extra newline to preserve pyCMS compatibility
|
# add an extra newline to preserve pyCMS compatibility
|
||||||
if not isinstance(profile, ImageCmsProfile):
|
if not isinstance(profile, ImageCmsProfile):
|
||||||
profile = ImageCmsProfile(profile)
|
profile = ImageCmsProfile(profile)
|
||||||
return profile.profile.product_copyright + "\n"
|
return (profile.profile.copyright or "") + "\n"
|
||||||
except (AttributeError, IOError, TypeError, ValueError) as v:
|
except (AttributeError, IOError, TypeError, ValueError) as v:
|
||||||
raise PyCMSError(v)
|
raise PyCMSError(v)
|
||||||
|
|
||||||
|
|
|
@ -997,6 +997,8 @@ cms_profile_getattr_product_manufacturer(CmsProfileObject* self, void* closure)
|
||||||
static PyObject*
|
static PyObject*
|
||||||
cms_profile_getattr_product_copyright(CmsProfileObject* self, void* closure)
|
cms_profile_getattr_product_copyright(CmsProfileObject* self, void* closure)
|
||||||
{
|
{
|
||||||
|
PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
|
"product_copyright is deprecated. Use Unicode copyright instead.", 1);
|
||||||
return _profile_getattr(self, cmsInfoCopyright);
|
return _profile_getattr(self, cmsInfoCopyright);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user