[Checkins] SVN: grok/trunk/src/grok/publication.py Use another approach to fix this.

Martijn Faassen faassen at infrae.com
Thu Dec 11 18:53:33 EST 2008


Log message for revision 93923:
  Use another approach to fix this.
  

Changed:
  U   grok/trunk/src/grok/publication.py

-=-
Modified: grok/trunk/src/grok/publication.py
===================================================================
--- grok/trunk/src/grok/publication.py	2008-12-11 23:52:38 UTC (rev 93922)
+++ grok/trunk/src/grok/publication.py	2008-12-11 23:53:32 UTC (rev 93923)
@@ -21,12 +21,17 @@
 from zope.security.checker import selectChecker
 from zope.publisher.publish import mapply
 
+from zope.publisher.interfaces.browser import IBrowserView
+
 from zope.app.publication.http import BaseHTTPPublication, HTTPPublication
 from zope.app.publication.browser import BrowserPublication
 from zope.app.publication.requestpublicationfactories import \
      BrowserFactory, XMLRPCFactory, HTTPFactory
 from zope.app.http.interfaces import IHTTPException
 
+from grokcore.view import View as GrokView
+from grok.components import JSON
+
 class ZopePublicationSansProxy(object):
 
     def getApplication(self, request):
@@ -36,11 +41,15 @@
     def traverseName(self, request, ob, name):
         result = super(ZopePublicationSansProxy, self).traverseName(
             request, ob, name)
-        if request.getTraversalStack():
-            return removeSecurityProxy(result)
+        bare_result = removeSecurityProxy(result)
+        if IBrowserView.providedBy(bare_result):
+            if isinstance(bare_result, GrokView) or isinstance(bare_result, JSON):
+                return bare_result
+            else:
+                return result
         else:
-            return result
-    
+            return bare_result
+
     def callObject(self, request, ob):
         checker = selectChecker(ob)
         if checker is not None:



More information about the Checkins mailing list