-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scales create NamedBlobImage with wrong contentType field #38
Comments
I can confirm this issue and I can also confirm fixing it is not that easy as getting rid of the we need to write an upgrade step or to find out a good place for data casting. @plone/framework-team ideas? |
maybe we can add a cast before raise the validation exception.. that's the unique place where we have problems.. the image is showed without problem. |
A little bit more information about the original exception: /home/rodfersou/.anyenv/envs/pyenv/versions/2.7.12/envs/collective.cover/lib/python2.7/site-packages/IPython/core/debugger.py:238: DeprecationWarning: The `color_scheme` argument is deprecated since version 5.1
DeprecationWarning)
> /home/rodfersou/.projects/cache/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_bootstrapfields.py(210)_validate()
208 if self._type is not None and not isinstance(value, self._type):
209 import debug
--> 210 raise WrongType(value, self._type, self.__name__)
211
212 if not self.constraint(value):
ipdb> value
u'image/jpeg'
ipdb> self._type
<type 'str'>
ipdb> self
<zope.schema._field.BytesLine object at 0x7f0b568b7c50>
ipdb> self.__name__
'contentType' |
a try..except with a note could be a good idea, with a comment pointing to this issue for example. |
@gforcada where would be the right place for this try..except? |
@rodfersou you were pointing to a single place where this could be wrapped in a try..except already some comments above: #38 (comment) |
@gforcada I'm not sure if the place I pointed is the right one, since the exception is too generic for many cases. maybe add a IF statement to don't raise the exception in one specific condition would work out. |
@thet comments, please! |
@hvelarde @rodfersou an upgrade step to fix the wrong contentType values + a plone.namedfile fix to not turn the contentType to unicode would be it, IMO. |
A try..except in zope.schema with a cast on except is not an option, if understood the discussion above correctly. |
@thet can you guide me on how this upgrade step would be? are there any way to search for every configlet with image widget where this exception happen? |
@rodfersou keep it simple: search for images and scales only; my only concern is about the upgrade step memory consumption. |
+1
I can help out next week. I'm currently on my way back to Austria.
|
NamedBlobImage
contentType
field should be string not unicode.But when the image is scaled, it becomes unicode, what creates validation issues in image fields 1, 2.
This bug was introduced in this refactoring.
The text was updated successfully, but these errors were encountered: