[Zope-CMF] Re: Method Aliases

Yuppie schubbe at web.de
Wed Oct 8 12:49:32 EDT 2003


Hi!


Thanks for your feedback!

Dieter Maurer wrote:
> Yuppie wrote at 2003-10-4 13:13 +0200:
>  > <diff>
                            if len(default_path) > 1:
                                path = list(default_path)
                                method = path.pop()
>  >                           request['TraversalRequestNameStack'] = path
>  >                           continue
>  >                       else:
>  > -                         method = default_path[0]
>  > -                         entry_name = method
>  > +                         entry_name = default_path[0]
>  >                   elif (method and hasattr(object,method)
>  >                         and entry_name != method
>  >                         and getattr(object, method) is not None):
>  >                       request._hacked_path=1
>  >                       entry_name = method
>  > +                     method = 'index_html'
>  >                   else:
>  >                       if (hasattr(object, '__call__') and
>  >                           hasattr(object.__call__,'__roles__')):
>  > </diff>
> 
> With your first change, you ensure that "method" is no longer
> modified. Therefore, the second change is not necessary.

I added 3 more lines to the diff above. Hope that makes it clearer. The 
first change affects just the else clause. The second change is 
necessary for the if clause.

> Your modification still does not yet cope with "default_path[0]==''".
> This will still lead to an infinite recursion.

Ok. Now I see what your patch does. I'm not sure if '' is a valid method 
at all. I thought the rule is to use index_html as method name combined 
with index_html set to None.

But even if '' is an invalid value, sending the request in an infinite 
loop is of course a bad reaction.


Cheers,
	Yuppie





More information about the Zope-CMF mailing list