[Zope] Re: Constructing 'Friendly' URLs in products

Tres Seaver tseaver at zope.com
Thu Dec 2 10:38:20 EST 2004


Phillip Hutchings wrote:
> On Thu, 2 Dec 2004 01:49:11 -0500, Paul Winkler <pw_lists at slinkp.com> wrote:
> 
>>On Thu, Dec 02, 2004 at 03:52:02PM +1300, Phillip Hutchings wrote:
 >>
>>>I was also
>>>thinking of a single class that used something like __getattr__ to
>>>process a function or something, but I haven't though of how that
>>>would work. Probably like this myPosts =
>>>{'2004':{'11':{'04':{'wow-zope-is-cool':getBlogPost}}}}, but I'm not
>>>sure if that would even work.
>>
>>Close.  define __bobo_traverse__(REQUEST, name) instead of
>>__getattr__.  The latter is already heavily used by security
>>and acquisition and attempting to overload it is likely to
>>lead to pain and frustration.
> 
> Ah, OK, I'll look at it.

__getitem__ is actually simpler than __bobo_traverse__;  I have often 
started with __bobo_traverse__, because I thought I needed it, and ended 
up rerwriting as __getitem__.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com



More information about the Zope mailing list