[Zope-CMF] __browser_default__ broken in CMF 1.4.x

Andy McKay andy at agmweb.ca
Mon Sep 29 00:59:01 EDT 2003


 From what I can tell CMF 1.4x is broken if you try to use 
__browser_default__ (the interface to use something other than index_html).

The following traversal hook in DynamicType.py breaks 
__browser_default__ and sends ZPublisher/BaseRequest.py into an infinite 
loop. Removing this method makes it work just like normal.

This checkin was made by Yuppie and has no doc string or explanation in 
the cvs checkin. Its from the aliases branch, so I guess its something 
to do with that ;)

Would anyone care to explain what it actually is meant to acheive in 
English so we can find a better solution?

     def __before_publishing_traverse__(self, arg1, arg2=None):
         """ Pre-traversal hook.
         """
         # XXX hack around a bug(?) in BeforeTraverse.MultiHook
         REQUEST = arg2 or arg1

         if REQUEST['REQUEST_METHOD'] not in ('GET', 'POST'):
             return

         stack = REQUEST['TraversalRequestNameStack']
         key = stack and stack[-1] or '(Default)'
         ti = self.getTypeInfo()
         path = ti and ti.getMethodPath(key) or None
         if path:
             if key is not '(Default)':
                 stack.pop()
             for id in path:
                 if id is not '(Default)':
                     stack.append(id)
-- 
   Andy McKay
   http://www.agmweb.ca




More information about the Zope-CMF mailing list