[Zope] No question

Stefan H. Holek stefan@epy.co.at
Fri, 16 May 2003 15:29:30 +0200


This should probably be made

    getattr(self.aq_base, foldername, None)

to avoid being bitten by unintended implicit acquisition.

Stefan



--On Freitag, 16. Mai 2003 15:04 +0200 Lennart Regebro <lennart@regebro.nu> 
wrote:

> Wim Bekker wrote:
>
>> def findObject(self,foldername):
>>     """
>>     find an object with the same name as foldername in object self
>>     """
>>     result=None
>>     for object in self.objectValues():
>>         tit=object.getId()
>>         if tit==foldername:
>>             result=object
>>     return result
>
> This is quicker and should work:
>
> def findObject(self,foldername):
>      """
>      find an object with the same name as foldername in object self
>      """
>      return getattr(self, foldername, None)

--
The time has come to start talking about whether the emperor is as well
dressed as we are supposed to think he is.               /Pete McBreen/