Skip to content
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

imagecropping fails when tag is constructed with width/height instead of a scale on Plone 5.2/Py3 #99

Open
agitator opened this issue Sep 24, 2019 · 1 comment

Comments

@agitator
Copy link
Member

https://pypi.org/project/plone.app.imaging/ allows you to create an image tag based on width/height parameters instead of a defined scale.

On Plone 5.2 with Py3 this doesn't seem to work anymore

2019-09-24 09:38:16,817 ERROR   [Zope.SiteErrorLog:18][waitress] 1569310696.7523960.7170251583816479 http://localhost:11783/Plone/de/testcollection/listing_summary
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module zope.browserpage.simpleviewclass, line 41, in __call__
  Module Products.Five.browser.pagetemplatefile, line 126, in __call__
  Module Products.Five.browser.pagetemplatefile, line 61, in __call__
  Module zope.pagetemplate.pagetemplate, line 135, in pt_render
  Module Products.PageTemplates.engine, line 88, in __call__
  Module z3c.pt.pagetemplate, line 173, in render
  Module chameleon.zpt.template, line 306, in render
  Module chameleon.template, line 209, in render
  Module chameleon.utils, line 75, in raise_with_traceback
  Module chameleon.template, line 187, in render
  Module a5043e9b73127f8cdc659dfc6690671b.py, line 849, in render
  Module 2cb67c7a5a5355d80d9db87b3e0f6191.py, line 683, in render_master
  Module 2cb67c7a5a5355d80d9db87b3e0f6191.py, line 1239, in render_content
  Module a5043e9b73127f8cdc659dfc6690671b.py, line 835, in __fill_content_core
  Module c202c80fbab3fe16960e58390b44c016.py, line 113, in render_content_core
  Module c202c80fbab3fe16960e58390b44c016.py, line 426, in render_listing
  Module a5043e9b73127f8cdc659dfc6690671b.py, line 813, in __fill_entries
  Module c202c80fbab3fe16960e58390b44c016.py, line 751, in render_entries
  Module a5043e9b73127f8cdc659dfc6690671b.py, line 558, in __fill_entry
  Module plone.memoize.volatile, line 73, in replacement
  Module plone.namedfile.scaling, line 528, in tag
  Module plone.namedfile.scaling, line 507, in tag
  Module plone.namedfile.scaling, line 439, in scale
  Module plone.scale.storage, line 210, in scale
  Module plone.app.imagecropping.dx, line 61, in __call__
  Module plone.app.imagecropping.storage, line 60, in read
  Module plone.app.imagecropping.storage, line 20, in _key
TypeError: unsupported format string passed to NoneType.__format__

 - Expression: "tem_type_class python:('contenttype-' + view.normalizeString(item_type)) if sh"
 - Filename:   ... .egg/plone/app/contenttypes/browser/templates/listing.pt
 - Location:   (line 48: col 17)
 - Source:     ... tem_type_class python:('contenttype-' + view.normalizeString(item_type)) if sh ...
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "batch"
 - Filename:   ... .egg/plone/app/contenttypes/browser/templates/listing.pt
 - Location:   (line 28: col 30)
 - Source:     <tal:listing condition="batch">
                                       ^^^^^
 - Expression: "provider:plone.abovecontentbody"
 - Filename:   ... egg/Products/CMFPlone/browser/templates/main_template.pt
 - Location:   (line 94: col 70)
 - Source:     ... 
                                     ^
 - Expression: "context/@@main_template/macros/master"
 - Filename:   ... /srcclient/client.site/src/client/site/browser/listing_summary.pt
 - Location:   (line 6: col 21)
 - Source:     ... tal:use-macro="context/@@main_template/macros/master"
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  template: <ViewPageTemplateFile - at 0x11780d5f8>
               options: {...} (0)
               args: <tuple - at 0x1066d8048>
               nothing: <NoneType - at 0x106578928>
               modules: <_SecureModuleImporter - at 0x1099a4550>
               request: <WSGIRequest - at 0x11794c358>
               view: <SimpleViewClass from /Users/peter/workspace/clientupdatepy3/srcclient/client.site/src/client/site/browser/listing_summary.pt listing_summary at 0x1179c1eb8>
               context: <ImplicitAcquisitionWrapper testcollection at 0x10fda7798>
               views: <ViewMapper - at 0x117653e10>
               here: <ImplicitAcquisitionWrapper testcollection at 0x10fda7798>
               container: <ImplicitAcquisitionWrapper testcollection at 0x10fda7798>
               root: <ImplicitAcquisitionWrapper  at 0x10e2ea510>
               traverse_subpath: <list - at 0x1173f8248>
               user: <ImplicitAcquisitionWrapper - at 0x10fad3e58>
               default: <object - at 0x106733b40>
               repeat: {...} (0)
               loop: {...} (1)
               wrapped_repeat: <SafeMapping - at 0x117672548>
               target_language: <NoneType - at 0x106578928>
               translate: <function translate at 0x117728378>
               macroname: master
[31] > /Users/peter/workspace/clientupdatepy3/eggs/plone.app.imagecropping-2.2.1-py3.7.egg/plone/app/imagecropping/storage.py(20)_key()
-> return '{0:s}_{1:s}'.format(fieldname, scale)

@agitator
Copy link
Member Author

added a test to prove #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant