[ckan-changes] commit/ckanext-spatial: amercader: [api] Return only packages with state = active

Bitbucket commits-noreply at bitbucket.org
Mon Nov 14 18:02:36 UTC 2011


1 new commit in ckanext-spatial:


https://bitbucket.org/okfn/ckanext-spatial/changeset/b13bda7c935d/
changeset:   b13bda7c935d
user:        amercader
date:        2011-11-14 19:00:56
summary:     [api] Return only packages with state = active
affected #:  1 file

diff -r effd4abb74d4478eecab2b37653ee780059c7788 -r b13bda7c935dff51bfa415fcd084fb86310d9ae4 ckanext/spatial/controllers/api.py
--- a/ckanext/spatial/controllers/api.py
+++ b/ckanext/spatial/controllers/api.py
@@ -2,7 +2,7 @@
 
 from ckan.lib.base import request, config, abort
 from ckan.controllers.api import ApiController as BaseApiController
-from ckan.model import Session
+from ckan.model import Session, Package
 
 from ckanext.spatial.lib import get_srid
 from ckanext.spatial.model import PackageExtent
@@ -44,7 +44,11 @@
         else:
             input_geometry = WKTSpatialElement(wkt,self.db_srid)
 
-        extents = Session.query(PackageExtent).filter(PackageExtent.the_geom.intersects(input_geometry))
+        extents = Session.query(PackageExtent) \
+                  .filter(PackageExtent.package_id==Package.id) \
+                  .filter(PackageExtent.the_geom.intersects(input_geometry)) \
+                  .filter(Package.state==u'active')
+
         ids = [extent.package_id for extent in extents]
 
         output = dict(count=len(ids),results=ids)

Repository URL: https://bitbucket.org/okfn/ckanext-spatial/

--

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