[Checkins] SVN: grok/trunk/src/grok/ Simplify the security check to just always look for IGrokSecurityView

Martijn Faassen faassen at infrae.com
Wed Jan 7 15:31:04 EST 2009


Log message for revision 94602:
  Simplify the security check to just always look for IGrokSecurityView
  and make the basic Grok classes implement that interface.
  

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

-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py	2009-01-07 20:30:37 UTC (rev 94601)
+++ grok/trunk/src/grok/components.py	2009-01-07 20:31:04 UTC (rev 94602)
@@ -273,7 +273,8 @@
         return self.request.response
 
 class JSON(BrowserPage):
-
+    interface.implements(interfaces.IGrokSecurityView)
+    
     def __call__(self):
         view_name = self.__view_name__
         method = getattr(self, view_name)

Modified: grok/trunk/src/grok/publication.py
===================================================================
--- grok/trunk/src/grok/publication.py	2009-01-07 20:30:37 UTC (rev 94601)
+++ grok/trunk/src/grok/publication.py	2009-01-07 20:31:04 UTC (rev 94602)
@@ -77,10 +77,8 @@
             request, ob, name)
         bare_result = removeSecurityProxy(result)
         if IBrowserView.providedBy(bare_result):
-            if isinstance(bare_result, (GrokView, JSON)):
+            if IGrokSecurityView.providedBy(bare_result):
                 return bare_result
-            elif IGrokSecurityView.providedBy(bare_result):
-                return bare_result
             else:
                 return result
         else:



More information about the Checkins mailing list