The name could change easily enough.

How about __bobo_always_allow__

Which can either be:
A List of traversable items
A method that takes the path, and returns whether or not it is

So for a path p:

if p[0] == '_':
        if p_object.__bobo_always_allow__:
        if type(p_object.__bobo_always_allow__) is type([]):
                if p in p_object.__bobo_always_allow__:
                                #Do what is normally done for '_' bits.
                        if p_object.__bobo_always_allow__(p):
                                #Do what is normally done for '_' bits. 
        #Do what is normally done for '_' bits.

Something vaguely like that.

That way you could either specify the exact items that start with '_',
or have a method determine it on the fly.

This way you would not automatically make all attributes that start with
an underscore
accessible, and the developer could specify exceptions.

-----Original Message-----
From: Chris McDonough [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 02, 2005 4:15 PM
To: Dan Pozmanter
Subject: Re: [Zope] Silly question

The DWIM of not disallowing traversal of underscore names is useful
(because it makes it easy to conventionally mark attrs as private) but
it can definitely be a drag if you really do want to publish something
that begins with an underscore; this happens a lot when you need to deal
with allowing uploads of arbitrary filenames.

It might be useful to add something like you propose, except I might
take exception to the name "isTraversable" (everything is traversable,
really); maybe just set a magic attr on the object like

However, adding such a feature would need to be done carefully.  Much
usage of the Zope security machinery utterly depends on not being able
to traverse underscore names.

- C

On Thu, 2005-06-02 at 15:59 -0400, Dan Pozmanter wrote:
> Wouldn't it be cool if instead of checking explicitly for a leading 
> '_' during traversal, you ran a method "isTraversable" (On SimpleItem 
> for instance), which by default just checks for a leading '_', but 
> could be overridden in a particular class?
> Dan
> _______________________________________________
> Zope maillist  -
> **   No cross posts or HTML encoding!  **
> (Related lists -
> )

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to