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

Bitbucket commits-noreply at bitbucket.org
Fri Jul 8 14:30:42 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/df8e1767b53d/
changeset:   df8e1767b53d
branch:      feature-1141-moderated-edits-ajax
user:        dread
date:        2011-07-08 16:16:24
summary:     [branch] close.
affected #:  0 files (0 bytes)

http://bitbucket.org/okfn/ckan/changeset/6c08ad3fb5f2/
changeset:   6c08ad3fb5f2
user:        dread
date:        2011-07-08 16:29:16
summary:     [merge] from feature-1141-moderated-edits-ajax.
affected #:  17 files (1.2 KB)

--- a/ckan/controllers/package.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/controllers/package.py	Fri Jul 08 15:29:16 2011 +0100
@@ -377,6 +377,8 @@
                 data, errors = validate(data, schema)
         except NotAuthorized:
             abort(401, _('Unauthorized to read package %s') % '')
+        except NotFound:
+            abort(404, _('Package not found'))
 
         ## hack as db_to_form schema should have this
         data['tag_string'] = ' '.join([tag['name'] for tag in data.get('tags', [])])


--- a/ckan/lib/dictization/__init__.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/lib/dictization/__init__.py	Fri Jul 08 15:29:16 2011 +0100
@@ -122,7 +122,10 @@
 
     if context.get('pending'):
         if session.is_modified(obj, include_collections=False):
-            obj.state = 'pending'
+            if table_dict.get('state', '') == 'deleted':
+                obj.state = 'pending-deleted'
+            else:
+                obj.state = 'pending'
 
     session.add(obj)
 


--- a/ckan/lib/search/sql.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/lib/search/sql.py	Fri Jul 08 15:29:16 2011 +0100
@@ -222,7 +222,7 @@
 
         document_a = u' '.join((pkg_dict.get('name') or u'', pkg_dict.get('title') or u''))
         document_b_items = []
-        for field_name in ['notes', 'tags', 'groups', 'author', 'maintainer']:
+        for field_name in ['notes', 'tags', 'groups', 'author', 'maintainer', 'url']:
             val = pkg_dict.get(field_name)
             if val:
                 document_b_items.append(val)


--- a/ckan/logic/action/get.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/logic/action/get.py	Fri Jul 08 15:29:16 2011 +0100
@@ -30,6 +30,9 @@
     limit = context.get("limit")
 
     q = ckan.authz.Authorizer().authorized_query(user, model.PackageRevision)
+    q = q.filter(model.PackageRevision.state=='active')
+    q = q.filter(model.PackageRevision.current==True)
+
     q = q.order_by(model.package_revision_table.c.revision_timestamp.desc())
     if limit:
         q = q.limit(limit)


--- a/ckan/logic/action/update.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/logic/action/update.py	Fri Jul 08 15:29:16 2011 +0100
@@ -159,6 +159,7 @@
 
     if pkg is None:
         raise NotFound(_('Package was not found.'))
+    context["id"] = pkg.id
 
     check_access(pkg, model.Action.EDIT, context)
 


--- a/ckan/tests/functional/api/model/test_package.py	Fri Jul 08 14:45:00 2011 +0100
+++ b/ckan/tests/functional/api/model/test_package.py	Fri Jul 08 15:29:16 2011 +0100
@@ -113,6 +113,25 @@
         package = self.get_package_by_name(self.package_fixture_data['name'])
         assert package
         self.assert_equal(package.title, self.package_fixture_data['title'])
+        
+    def test_register_post_bad_content_type(self):
+        assert not self.get_package_by_name(self.package_fixture_data['name'])
+        offset = self.package_offset()
+        data = self.dumps(self.package_fixture_data)
+        res = self.http_request(offset, data,
+                                content_type='something/unheard_of',
+                                status=[self.STATUS_400_BAD_REQUEST,
+                                        self.STATUS_201_CREATED],
+                                extra_environ=self.extra_environ)
+        self.remove()
+        # Some versions of webob work, some don't. No matter, we record this
+        # behaviour.
+        package = self.get_package_by_name(self.package_fixture_data['name'])
+        if res.status == self.STATUS_400_BAD_REQUEST:
+            # Check there is no database record.
+            assert not package
+        else:
+            assert package        
 
     def test_register_post_json(self):
         assert not self.get_package_by_name(self.package_fixture_data['name'])

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