Ticket #1890 (new defect)

Opened 12 years ago

Last modified 9 years ago

Image without image breaks Image Gallery

Reported by: gracinet Owned by: madarche
Priority: P2 Milestone: CPS 3.5.7
Component: CPSDocument Version: TRUNK
Severity: major Keywords: image gallery


In an Image Gallery, if there is an Image document in which no image file has been stored (field name is preview), the view page of Image Gallery is broken (layout_image_gallery_view). One gets the Zope auth popup.

Extract from traceback info:

URL: file:CPSDocument/skins/cps_document/layout_imagegallery_view.pt

Line 49, Column 10

Expression: <PythonExpr here.getImgTag(                                item.absolute_url_path()+'/preview',  


    *  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
      __traceback_info__: here.getImgTag( item.absolute_url_path()+'/preview', base_url='',width=th_width,height=th_height, keep_ratio=1, img=item.restrictedTraverse('preview'))
    * Module Python expression "here.getImgTag( item.absolute_url_path()+'/preview', base_url='',width=th_width,height=th_height, keep_ratio=1, img=item.restrictedTraverse('preview'))", line 1, in <expression>
    * Module OFS.Traversable, line 250, in restrictedTraverse
    * Module OFS.Traversable, line 218, in unrestrictedTraverse
      __traceback_info__: ([], 'preview')

Indeed, it seems that a protection against None is missing somewhere.

Also, the image file is not mandatory in Image doc type (will change that in my specific project)

Change History

comment:1 Changed 12 years ago by gracinet

  • Severity changed from normal to major

The 'is_required' flag of Image Widget doesn't work for me.

comment:2 Changed 12 years ago by rspivak

I see two options here:
1) Handle correctly empty images in Gallery.
2) Make is_required field for Images to work and have it turned "on" by default.

The latter is easier and I have required changes locally ready to be committed if (2) is OK.

comment:3 Changed 12 years ago by madarche

Option 2) OK for me :-) Thanks!

comment:4 Changed 12 years ago by rspivak

Fix is commited in rev [52842].

Part of the fix includes setting 'is_required' to True by default for
'preview' field in image layout (done in CPSDefault package).
Another part of fix is to correctly handle 'is_required' field when no
image was supplied to 'Image Widget'(done in CPSSchemas.BasicWidgets? ).

comment:5 Changed 9 years ago by gracinet

Shouldn't we close it then ? The way it's been done, it is probably not affected by changes related to #2204

Note: See TracTickets for help on using tickets.