[Zope-CMF] Re: types tool and aliases

Miles Waller miles at jamkit.com
Mon Jul 17 06:25:06 EDT 2006


yuppie wrote:
> Hi Miles!
> 
> 
> Miles Waller wrote:
> 
>> I have a question about aliases in the types tool that I'm hoping some 
>> can answer pretty easily.
>>
>> In the management screen, there's a line which says:
>>
>> For backwards compatibility there is also a '(Default)' method:
>>     Calls index_html or __call__, depending on the class
>>
>> For some old type information in a project here, the guess aliases 
>> process assigns the alias '(Default)' with the method (Default).  This 
>> in turn creates an attribute error, as there is no method '(Default)'.
> 
> 
> Without seeing the traceback I can't tell what's exactly going wrong 
> here. DynamicType.__before_publishing_traverse__ should do this right. 
> There might be other places where queryMethodID is used and '(Default)' 
> not handled correctly.

Here's the traceback:

Traceback (innermost last):
   Module ZPublisher.Publish, line 114, in publish
   Module ZPublisher.mapply, line 88, in mapply
   Module ZPublisher.Publish, line 40, in call_object
   Module Products.CMFCore.PortalContent, line 101, in __call__
AttributeError: (Default)

The URL called is /myfolder/mytype and the (Default) alias has the entry 
  (Default).  Making this blank solves the problem.

>> What I want to know is, is this an error (i.e. if the alias (Default) 
>> also points to a method (Default), should this just be ignored) or is 
>> there some use for this behaviour?  I'd like to fix this for my type 
>> infomration, but don't want to mask anything clever.
> 
> 
> _guessMethodAliases is not very clever. If index_html of your types is 
> not None you just can replace '(Default)' by 'index_html'. If the 
> __call__ method has no complex logic you might be able to replace 
> '(Default)' by a real method. This would be much saner than using the 
> '(Default)' backwards compatibility hack.

My problem is that I have a lot of sites with wrongly-guessed aliases, 
and no time to go through and reset them!  I think I'll just patch my 
types to fall back to the old way of finding views if they encounter a 
method (Default) as well as if the method is blank for the moment, and 
deal with trying to work them out properly later.

Thanks for the help,

Miles





More information about the Zope-CMF mailing list