-
Notifications
You must be signed in to change notification settings - Fork 55
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
Can't edit basic tile with Dexterity-based content types #637
Comments
@hvelarde sorry, I have no clue what's going on there. |
@hvelarde: no traceback and nothing else in the console? |
@davilima6 nothing; seems some invariant or validator in the image widget. |
This validation looks to be into zope.schema._field.py file |
I found the problem but I have no idea how to fix it: the value of the > /home/hvelarde/.buildout/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_field.py(586)_validate()
-> raise WrongContainedType(errors, self.__name__)
(Pdb) errors
[WrongType(u'image/jpeg', <type 'str'>, 'contentType')]
(Pdb) self.schema
<InterfaceClass plone.namedfile.interfaces.INamedBlobImage>
(Pdb) value
<plone.namedfile.file.NamedBlobImage object at 0x7f48ec341848>
(Pdb) value.contentType
u'image/jpeg'
(Pdb) type(value.contentType)
<type 'unicode'> I have no idea of what's the cause of this bug. @idgserpro can you confirm if this happens on the IDGB project, please? |
according to @datakurre Dexterity and z3c.form converts all form data into we need to check if this fixes it: https://github.com/plone/plone.app.tiles/pull/10/files |
It looks like this is the same bug https://community.plone.org/t/migration-collective-jsonify-news-item-images-lead-image-wrong-contained-type/1544 |
@hvelarde @datakurre the fixes done at p.a.tiles raises an exception with c.cover tiles: 2016-12-22 11:52:05 ERROR Zope.SiteErrorLog 1482414725.910.636643873446 http://localhost:8080/Plone/capa/@@updatetilecontent
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
Module ZPublisher.Publish, line 48, in call_object
Module collective.cover.browser.compose, line 57, in __call__
Module collective.cover.browser.compose, line 52, in render
Module collective.cover.tiles.basic, line 122, in populate_with_object
Module z3c.form.form, line 37, in applyChanges
AttributeError: 'BasicTile' object has no attribute 'fields'
/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/z3c.form-3.2.9-py2.7.egg/z3c/form/form.py(37)applyChanges()
35 def applyChanges(form, content, data):
36 changes = {}
---> 37 for name, field in form.fields.items():
38 # If the field is not in the data, then go on to the next one
39 try: |
at my PR I just convert back |
it looks like the bug was introduced in this commit by @thet plone/plone.namedfile@33df023#diff-03f29bbadcdf640341c9061de5a07dccR299 When we scale the image, contentType attribute of NamedBlobImage object becomes unicode when it should be str |
@rodfersou I just tested and that's not the code causing the issue; maybe we have to look in plone.formwidget.namedfile also; anyway, what you found has to be fixed. |
how did you test it? here it works |
@rodfersou Great work! |
@rodfersou bug hunting at its best! |
wow, I tested again and you were totally right; the problem was I was testing with an image created prior to the patch... that means now we have a huge issue: all scales in the portal must have to be checked using an upgrade step because the |
Should be fixed via: @hvelarde if an upgrade step is really needed, talk to me. |
Plone 4.3.10 with plone.app.contenttypes 1.1.1 installed:
the following validation error is shown (
Wrong contained type
):this was not happening before with Plone 4.3.9.
The text was updated successfully, but these errors were encountered: