[Checkins]
SVN: grok/trunk/src/grok/ftests/security/handle_exception.py
- added test to assure handleException works correctly with grok
Christian Theune
ct at gocept.com
Sat Jan 6 12:10:41 EST 2007
Log message for revision 71746:
- added test to assure handleException works correctly with grok
Changed:
A grok/trunk/src/grok/ftests/security/handle_exception.py
-=-
Added: grok/trunk/src/grok/ftests/security/handle_exception.py
===================================================================
--- grok/trunk/src/grok/ftests/security/handle_exception.py 2007-01-06 16:53:42 UTC (rev 71745)
+++ grok/trunk/src/grok/ftests/security/handle_exception.py 2007-01-06 17:10:41 UTC (rev 71746)
@@ -0,0 +1,45 @@
+"""
+
+The handleException() method has a special case that might introduce a proxy
+and cause the grok security to fail, we have a simple test here that assures
+that we don't hit this:
+
+ >>> import grok
+ >>> grok.grok('grok.ftests.security.handle_exception')
+ >>> from zope.testbrowser.testing import Browser
+ >>> browser = Browser()
+ >>> browser.open("http://localhost/@@cave")
+ Traceback (most recent call last):
+ HTTPError: HTTP Error 500: Internal Server Error
+ >>> browser.contents
+ "It's gone!"
+
+"""
+
+import zope.interface
+
+import grok
+
+
+class CaveWasRobbedError(Exception):
+ pass
+
+
+class Cave(grok.View):
+
+ grok.context(zope.interface.Interface)
+
+ fire = "It's gone!"
+
+ def render(self):
+ raise CaveWasRobbedError("EVERYTHING GONE! GROK ANGRY!")
+
+
+class CaveErrorView(grok.View):
+
+ grok.context(CaveWasRobbedError)
+ grok.name("index.html")
+
+ def render(self):
+ self.request.response.setStatus(500)
+ return self.context.__parent__.fire
Property changes on: grok/trunk/src/grok/ftests/security/handle_exception.py
___________________________________________________________________
Name: svn:keywords
+ Id Rev Date
Name: svn:eol-style
+ native
More information about the Checkins
mailing list