Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev
Another OFS.Traversable and ZPublisher inconsistency
 

Index | Next | Previous | View Flat


optilude+lists at gmail

May 22, 2009, 10:00 PM


Views: 248
Permalink
Another OFS.Traversable and ZPublisher inconsistency

Hi,

So, we determined that OFS.Traversable's unrestrictedTraverse()
shouldn't grow support for IPublishTraverse, which is fair enough. We're
now using an ITraversable adapter instead (++namespace++).

However, we found another inconsistency. In URL traversal, this works:

/foo/bar/++namespace++/123

In OFS.Traversable, it doesn't, but this does:

/foo/bar/++namespace++blah/123

The reason is that in restrictedTraverse(), we have this check:

if name and name[:1] in '@+' and name != '+' and nsParse(name)[1]:
ns, nm = nsParse(name)

However, nsParse(name)[1] is '' if no name is provided after the namespace.

In BaseRequest.traverseName() we have a similar, but more relaxed check:

if name and name[:1] in '@+'
ns, nm = nsParse(name)
if ns:
...

This also has the advantage of not calling nsParse() twice.

I can't understand why OFS.Traversable would explicitly disallow
namespace traversal with an empty string as the name. Is this on
purpose, or a bug?

Cheers,
Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-Dev maillist - Zope-Dev[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Subject User Time
Another OFS.Traversable and ZPublisher inconsistency optilude+lists at gmail May 22, 2009, 10:00 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.