[ckan-changes] commit/ckan: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Thu Aug 25 11:45:54 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/c67d5934fb0b/
changeset:   c67d5934fb0b
branch:      release-v1.4.3
user:        dread
date:        2011-08-25 13:41:28
summary:     [controllers]: #1176 Fixed exception when viewing error document when there is no error redirection to it.
affected #:  2 files (433 bytes)

--- a/ckan/controllers/error.py	Tue Aug 09 14:26:38 2011 +0100
+++ b/ckan/controllers/error.py	Thu Aug 25 12:41:28 2011 +0100
@@ -25,6 +25,10 @@
         """Render the error document"""
         original_request = request.environ.get('pylons.original_request')
         original_response = request.environ.get('pylons.original_response')
+        # When a request (e.g. from a web-bot) is direct, not a redirect
+        # from a page. #1176
+        if not original_response:
+            return 'There is no error.'
         # Bypass error template for API operations.
         if original_request and original_request.path.startswith('/api'):
             return original_response.body


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckan/tests/functional/test_error.py	Thu Aug 25 12:41:28 2011 +0100
@@ -0,0 +1,7 @@
+from base import FunctionalTestCase
+
+class TestError(FunctionalTestCase):
+    def test_without_redirect(self):
+        # this is what a web bot might do
+        res = self.app.get('/error/document')
+        assert 'There is no error.' in str(res), str(res)


http://bitbucket.org/okfn/ckan/changeset/fc8712a7a61b/
changeset:   fc8712a7a61b
user:        dread
date:        2011-08-25 13:45:05
summary:     [merge] from release-v1.4.3
affected #:  2 files (433 bytes)

--- a/ckan/controllers/error.py	Thu Aug 25 12:03:56 2011 +0100
+++ b/ckan/controllers/error.py	Thu Aug 25 12:45:05 2011 +0100
@@ -25,6 +25,10 @@
         """Render the error document"""
         original_request = request.environ.get('pylons.original_request')
         original_response = request.environ.get('pylons.original_response')
+        # When a request (e.g. from a web-bot) is direct, not a redirect
+        # from a page. #1176
+        if not original_response:
+            return 'There is no error.'
         # Bypass error template for API operations.
         if original_request and original_request.path.startswith('/api'):
             return original_response.body


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckan/tests/functional/test_error.py	Thu Aug 25 12:45:05 2011 +0100
@@ -0,0 +1,7 @@
+from base import FunctionalTestCase
+
+class TestError(FunctionalTestCase):
+    def test_without_redirect(self):
+        # this is what a web bot might do
+        res = self.app.get('/error/document')
+        assert 'There is no error.' in str(res), str(res)

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list