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
7d157bd825
commit
a149c13d2e
|
@ -376,7 +376,12 @@ class TestImageCms(PillowTestCase):
|
|||
self.assertEqual(p.product_desc, 'sRGB IEC61966-2-1 black scaled')
|
||||
self.assertEqual(p.product_description,
|
||||
'sRGB IEC61966-2-1 black scaled')
|
||||
self.assertEqual(p.product_manufacturer, '')
|
||||
|
||||
# p.product_manufacturer
|
||||
result = self.assert_warning(
|
||||
DeprecationWarning, getattr, p, "product_manufacturer"
|
||||
)
|
||||
self.assertEqual(result, "")
|
||||
|
||||
# p.product_model
|
||||
result = self.assert_warning(DeprecationWarning, getattr, p, "product_model")
|
||||
|
|
|
@ -687,7 +687,7 @@ def getProfileName(profile):
|
|||
# // but if the Model and Manufacturer were the same or the model
|
||||
# // was long, Just the model, in 1.x
|
||||
model = profile.profile.model
|
||||
manufacturer = profile.profile.product_manufacturer
|
||||
manufacturer = profile.profile.manufacturer
|
||||
|
||||
if not (model or manufacturer):
|
||||
return profile.profile.product_description + "\n"
|
||||
|
@ -790,7 +790,7 @@ def getProfileManufacturer(profile):
|
|||
# add an extra newline to preserve pyCMS compatibility
|
||||
if not isinstance(profile, ImageCmsProfile):
|
||||
profile = ImageCmsProfile(profile)
|
||||
return profile.profile.product_manufacturer + "\n"
|
||||
return (profile.profile.manufacturer or "") + "\n"
|
||||
except (AttributeError, IOError, TypeError, ValueError) as v:
|
||||
raise PyCMSError(v)
|
||||
|
||||
|
|
|
@ -989,6 +989,8 @@ cms_profile_getattr_product_model(CmsProfileObject* self, void* closure)
|
|||
static PyObject*
|
||||
cms_profile_getattr_product_manufacturer(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"product_manufacturer is deprecated. Use Unicode manufacturer instead.", 1);
|
||||
return _profile_getattr(self, cmsInfoManufacturer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user