[Zope-CMF] Re: CVS: Products/CMFCore - PortalContent.py:1.47.2.1
yuppie
y.2005- at wcm-solutions.de
Sun May 8 12:28:05 EDT 2005
Hi Jens!
Jens Vagelpohl wrote:
> Update of /cvs-repository/Products/CMFCore
> In directory cvs.zope.org:/tmp/cvs-serv23261/CMFCore
>
> Modified Files:
> Tag: CMF-1_5-branch
> PortalContent.py
> Log Message:
> - CMFTopic.Topic/CMFCore.PortalContent: Both these classes were using
> the now-deprecated CMFCore.utils._getViewFor method, and strangely
> enough the deprecation warning didn't show. Replaced with the
> new method of getting the view.
Maybe the deprecation warning didn't show up because the method was
never called?
The first implementation of Method Aliases did never call objects
directly. __call__ was only used for backwards compatibility if no alias
was specified.
Before the release of CMF 1.5.0 I changed the Method Aliases machinery
and now in some situations the object is called directly, but forgot to
update __call__ on the 1.5 branch. So this needs to be fixed, but in a
different way.
> === Products/CMFCore/PortalContent.py 1.47 => 1.47.2.1 ===
> --- Products/CMFCore/PortalContent.py:1.47 Thu Aug 12 11:07:39 2004
> +++ Products/CMFCore/PortalContent.py Thu May 5 16:53:32 2005
> @@ -95,22 +94,22 @@
> return "%s %s" % (self.Title(), self.Description())
>
> def __call__(self):
> - '''
> - Invokes the default view.
> - '''
> - view = _getViewFor(self)
> - if getattr(aq_base(view), 'isDocTemp', 0):
> - return view(self, self.REQUEST)
> + """ Invokes the default view.
> + """
> + view_id = self.getTypeInfo().queryMethodID('view')
> + view_obj = self.unrestrictedTraverse(view_id)
> +
> + if getattr(aq_base(view_obj), 'isDocTemp', 0):
> + return view_obj(self, self.REQUEST)
> else:
> - return view()
> + return view_obj()
>
There are two issues with this checkin:
1.) It implements different behavior than CMF HEAD
2.) It breaks backwards compatibility
I propose to use the code from HEAD and the _getViewFor code as fallback
in case no '(Default)' alias is defined.
Cheers,
Yuppie
More information about the Zope-CMF
mailing list