[ckan-changes] commit/ckan: dread: [controllers]: #1078 Fix edit of unknown package - now returns 404 not 500.
Bitbucket
commits-noreply at bitbucket.org
Wed Jun 8 16:56:03 UTC 2011
1 new changeset in ckan:
http://bitbucket.org/okfn/ckan/changeset/c9c2f8f923b9/
changeset: c9c2f8f923b9
branch: release-v1.4.1
user: dread
date: 2011-06-08 18:55:35
summary: [controllers]: #1078 Fix edit of unknown package - now returns 404 not 500.
affected #: 2 files (241 bytes)
--- a/ckan/controllers/package.py Wed Jun 08 15:16:42 2011 +0100
+++ b/ckan/controllers/package.py Wed Jun 08 17:55:35 2011 +0100
@@ -333,6 +333,8 @@
data = data or old_data
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
+ except NotFound:
+ abort(404, _('Package not found'))
c.pkg = context.get("package")
@@ -656,7 +658,7 @@
package_name = id
package = model.Package.get(package_name)
if package is None:
- abort(404, gettext('404 Package Not Found'))
+ abort(404, gettext('Package Not Found'))
self._clear_pkg_cache(package)
rating = request.params.get('rating', '')
if rating:
--- a/ckan/tests/functional/test_package.py Wed Jun 08 15:16:42 2011 +0100
+++ b/ckan/tests/functional/test_package.py Wed Jun 08 17:55:35 2011 +0100
@@ -899,6 +899,11 @@
finally:
self._reset_data()
+ def test_edit_404(self):
+ self.offset = url_for(controller='package', action='edit', id='random_name')
+ self.res = self.app.get(self.offset, status=404)
+
+
class TestNew(TestPackageForm):
pkg_names = []
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