[Zope3-checkins] SVN: Zope3/branches/3.3/ - fixed issue 399: return
404 / NotFound instead of 505 / ComponentLookupError when a
skin isn't found during traversal
Christian Theune
cvs-admin at zope.org
Fri Jun 16 23:29:48 EDT 2006
Log message for revision 68699:
- fixed issue 399: return 404 / NotFound instead of 505 / ComponentLookupError when a skin isn't found during traversal
Changed:
U Zope3/branches/3.3/doc/CHANGES.txt
A Zope3/branches/3.3/src/zope/traversing/ftests/test_skin.py
U Zope3/branches/3.3/src/zope/traversing/namespace.py
U Zope3/branches/3.3/src/zope/traversing/tests/test_skin.py
-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt 2006-06-17 03:24:10 UTC (rev 68698)
+++ Zope3/branches/3.3/doc/CHANGES.txt 2006-06-17 03:29:43 UTC (rev 68699)
@@ -10,6 +10,9 @@
Bugfixes
+ - Fixed issue 399: traversal of missing skins now give 404 / NotFound
+ instead of 505 / ComponentLookupError
+
- Fixed issue 199: macro expansion in ZPT pages now work
- Fixed issues 648 and 593: uploading files with non-ASCII filenames now
@@ -223,7 +226,7 @@
Vasiliev, Tim Peters, Zachery Bir, Gary Poster, Egon Frerich, Zhiyun
(Simon) Hang, Tadashi Matsumoto, Simon Michael, Encople Degoute,
Shane Hathaway, Bjorn Tillenius, Sam Stainsby, Bernd Dorn, Benji York
- Stuart Bishop
+ Stuart Bishop, Christian Theune
------------------------------------------------------------------
Added: Zope3/branches/3.3/src/zope/traversing/ftests/test_skin.py
===================================================================
--- Zope3/branches/3.3/src/zope/traversing/ftests/test_skin.py 2006-06-17 03:24:10 UTC (rev 68698)
+++ Zope3/branches/3.3/src/zope/traversing/ftests/test_skin.py 2006-06-17 03:29:43 UTC (rev 68699)
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Functional tests for skin traversing
+
+$Id$
+"""
+import unittest
+from zope.app.testing import functional
+from zope.publisher.interfaces import NotFound
+
+class TestSkin(functional.BrowserTestCase):
+
+ def test_missing_skin(self):
+ self.assertRaises(NotFound, self.publish, "/++skin++missingskin")
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestSkin))
+ return suite
+
+
+if __name__ == '__main__':
+ unittest.main()
Property changes on: Zope3/branches/3.3/src/zope/traversing/ftests/test_skin.py
___________________________________________________________________
Name: svn:keywords
+ Id Rev Date
Name: svn:eol-style
+ native
Modified: Zope3/branches/3.3/src/zope/traversing/namespace.py
===================================================================
--- Zope3/branches/3.3/src/zope/traversing/namespace.py 2006-06-17 03:24:10 UTC (rev 68698)
+++ Zope3/branches/3.3/src/zope/traversing/namespace.py 2006-06-17 03:29:43 UTC (rev 68699)
@@ -362,7 +362,10 @@
def traverse(self, name, ignored):
self.request.shiftNameToApplication()
- skin = zope.component.getUtility(IBrowserSkinType, name)
+ try:
+ skin = zope.component.getUtility(IBrowserSkinType, name)
+ except ComponentLookupError:
+ raise TraversalError("++skin++%s" % name)
applySkin(self.request, skin)
return self.context
Modified: Zope3/branches/3.3/src/zope/traversing/tests/test_skin.py
===================================================================
--- Zope3/branches/3.3/src/zope/traversing/tests/test_skin.py 2006-06-17 03:24:10 UTC (rev 68698)
+++ Zope3/branches/3.3/src/zope/traversing/tests/test_skin.py 2006-06-17 03:29:43 UTC (rev 68699)
@@ -47,6 +47,14 @@
self.assert_(IFoo.providedBy(request))
self.assertEqual(request.shifted, 1)
+ def test_missing_skin(self):
+ from zope.traversing.namespace import skin
+ from zope.traversing.interfaces import TraversalError
+ request = FauxRequest()
+ ob = object()
+ traverser = skin(ob, request)
+ self.assertRaises(TraversalError, traverser.traverse, 'bar', ())
+
def test_suite():
return makeSuite(Test)
More information about the Zope3-Checkins
mailing list