[Zope-CMF] Re: problems w/ 'File' type in CMF 1.6

Raphael Ritz r.ritz at biologie.hu-berlin.de
Mon Nov 28 06:30:45 EST 2005


Rob Miller wrote:
> howdy,
> 
> in trying to get Plone working against the 1.6 branch i've come across 
> some problems w/ the way that CMFDefault.File.File is working since the 
> base classes have been reordered.
> 
> the biggest problem has to do w/ the default view lookup.  when 
> OFS.Image.File was the first base class, then that class's index_html 
> method would be used as the default view.  with PortalContent first, 
> however, index_html is None.  this causes ZPublisher to use __call__, 
> but this then calls queryMethodId('(Default)') on the FTI, which returns 
> index_html, which is still None.  when i add CMF File objects in a Plone 
> site and try to browse to them, i'm getting 404s; in a pure CMF site i 
> get a notice that 'index_html' has an empty or missing docstring.
> 
> the other problem, not as big an issue, has to do with the comment that 
> is immediately after the File class definition; it explicitly says that 
> the base classes should not be reordered b/c this would cover up the 
> id() method in the OFS.Image.File class.  using getId() will always 
> work, of course, and i'm not even sure that covering the id() method 
> will actually break anything, but it probably deserves a little bit of 
> investigation and, if all is well, we should remove the misleading comment.

Hi Rob,

I don't know the whole story behind this but I see two possible
work-arounds:

1. define 'index_html' to point to the one from File, i.e.

    (in the class def)
    index_html = OFS.Image.File.index_html

    that way bypassing the one from PortalContent without touching
    the order of inheritance.

2. Alternatively, set the '(Default)' method alias to something
    more sensible, e.g., 'file_view'

Would these work-arounds at least resolve the failing look-up?

How do others deal with this?

Raphael



More information about the Zope-CMF mailing list