Ticket #1890 (new defect)

Opened 7 months ago

Last modified 4 months ago

Image without image breaks Image Gallery

Reported by: gracinet Assigned to: madarche
Priority: P2 Milestone: CPS 3.4.7
Component: CPSDocument Version: TRUNK
Severity: major Keywords: image gallery
Cc:

Description

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

02/12/08 11:37:16 changed by gracinet

  • severity changed from normal to major.

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

05/06/08 02:09:17 changed 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.

05/06/08 09:16:14 changed by madarche

Option 2) OK for me :-) Thanks!

05/06/08 17:03:59 changed 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? ).