[ckan-changes] commit/ckanext-dgu: 13 new changesets

Bitbucket commits-noreply at bitbucket.org
Thu Nov 10 10:39:07 UTC 2011


13 new commits in ckanext-dgu:


https://bitbucket.org/okfn/ckanext-dgu/changeset/700286076024/
changeset:   700286076024
user:        Ian Murray
date:        2011-11-03 15:45:37
summary:     Removed unused 'package_create_slug_api_url' from the context.

 - the generation of the uri was causing form tests to fail, as
   it looks like the 'create_slug' action no longer exists.

 - the resulting uri stored on the context is not used, nor
   does it appear to have ever been used.
affected #:  1 file

diff -r 73bc5ee5a066ddbee81cb17f547c59bb41ebf355 -r 70028607602410376f3a99cdad8c4b942e399996 ckanext/dgu/forms/formapi.py
--- a/ckanext/dgu/forms/formapi.py
+++ b/ckanext/dgu/forms/formapi.py
@@ -111,10 +111,6 @@
             if not am_authz:
                 self._abort_not_authorized('User %r not authorized to create packages' % user.name)
 
-            api_url = config.get('ckan.api_url', '/').rstrip('/')
-            c.package_create_slug_api_url = \
-                   api_url + h.url_for(controller='api',
-                                       action='create_slug')
             # Get the fieldset.
             fieldset = self._get_package_fieldset()
             if request.method == 'GET':



https://bitbucket.org/okfn/ckanext-dgu/changeset/bb9ad6fb8b4b/
changeset:   bb9ad6fb8b4b
user:        Ian Murray
date:        2011-11-03 17:38:37
summary:     Fixed failing resource form tests: removed superfluous fields from the form.

The resource form's fields were generated from the Resource model's
fields.  This is unecessary, and now only the required fields are
hard-coded.  This was achieved by copy/pasting from the ckan form
module, and editing as required.  The reason for copy/pasting is that
otherwise, we'd have to wait for the next ckan release.  Copy/pasting
is OK because we'll be moving over to the new forms for DGU soon
anyway, so the duplication is short-lived.
affected #:  2 files

diff -r 70028607602410376f3a99cdad8c4b942e399996 -r bb9ad6fb8b4bbbf679fbb42221473b4c998eaf54 ckanext/dgu/forms/package_gov3.py
--- a/ckanext/dgu/forms/package_gov3.py
+++ b/ckanext/dgu/forms/package_gov3.py
@@ -1,12 +1,15 @@
 from sqlalchemy.util import OrderedDict
 from pylons.i18n import _, ungettext, N_, gettext
-from pylons import config
+from pylons import c, config
+from pylons.templating import render_genshi as render
+import formalchemy
 from formalchemy.fields import Field
+import re
 
 from ckan.forms import common
 from ckan.forms import package
 from ckan.forms.builder import FormBuilder
-from ckan.forms.common import ResourcesField, TagField, GroupSelectField, package_name_validator
+from ckan.forms.common import ConfiguredField, TagField, GroupSelectField, package_name_validator
 from ckan import model
 from ckan.lib.helpers import literal
 
@@ -127,3 +130,113 @@
         is_admin=is_admin, user_editable_groups=user_editable_groups,
         publishers=publishers, **kwargs).get_fieldset()
 
+class ResourcesField(ConfiguredField):
+    '''A form field for multiple dataset resources.'''
+
+    def __init__(self, name, hidden_label=False, fields_required=None):
+        super(ResourcesField, self).__init__(name)
+        self._hidden_label = hidden_label
+        self.fields_required = fields_required or set(['url'])
+        assert isinstance(self.fields_required, set)
+
+    def resource_validator(self, val, field=None):
+        resources_data = val
+        assert isinstance(resources_data, list)
+        not_nothing_regex = re.compile('\S')
+        errormsg = _('Dataset resource(s) incomplete.')
+        not_nothing_validator = formalchemy.validators.regex(not_nothing_regex,
+                                                             errormsg)
+        for resource_data in resources_data:
+            assert isinstance(resource_data, dict)
+            for field in self.fields_required:
+                value = resource_data.get(field, '')
+                not_nothing_validator(value, field)
+            
+    def get_configured(self):
+        field = self._ResourcesField(self.name).with_renderer(self.ResourcesRenderer).validate(self.resource_validator)
+        field._hidden_label = self._hidden_label
+        field.fields_required = self.fields_required
+        field.set(multiple=True)
+        return field
+
+    class _ResourcesField(formalchemy.Field):
+        def sync(self):
+            if not self.is_readonly():
+                pkg = self.model
+                res_dicts = self._deserialize() or []
+                pkg.update_resources(res_dicts, autoflush=False)
+
+        def requires_label(self):
+            return not self._hidden_label
+        requires_label = property(requires_label)
+
+        @property
+        def raw_value(self):
+            # need this because it is a property
+            return getattr(self.model, self.name)
+
+        def is_required(self, field_name=None):
+            if not field_name:
+                return False
+            else:
+                return field_name in self.fields_required
+
+
+    class ResourcesRenderer(formalchemy.fields.FieldRenderer):
+        def render(self, **kwargs):
+            c.resources = self.value or []
+            # [:] does a copy, so we don't change original
+            c.resources = c.resources[:]
+            c.resources.extend([None])
+            c.id = self.name
+            c.columns = ('url', 'format', 'description')
+            c.field = self.field
+            c.fieldset = self.field.parent
+            return render('package/form_resources.html')            
+
+        def stringify_value(self, v):
+            # actually returns dict here for _value
+            # multiple=True means v is a Resource
+            res_dict = {}
+            if v:
+                assert isinstance(v, model.Resource)
+                for col in model.Resource.get_columns() + ['id']:
+                    res_dict[col] = getattr(v, col)
+            return res_dict
+
+        def _serialized_value(self):
+            package = self.field.parent.model
+            params = self.params
+            new_resources = []
+            rest_key = self.name
+
+            # REST param format
+            # e.g. 'Dataset-1-resources': [{u'url':u'http://ww...
+            if params.has_key(rest_key) and any(params.getall(rest_key)):
+                new_resources = params.getall(rest_key)[:] # copy, so don't edit orig
+
+            # formalchemy form param format
+            # e.g. 'Dataset-1-resources-0-url': u'http://ww...'
+            row = 0
+            # The base columns historically defaulted to empty strings
+            # not None (Null). This is why they are seperate here.
+            base_columns = ['url', 'format', 'description', 'hash', 'id']
+            while True:
+                if not params.has_key('%s-%i-url' % (self.name, row)):
+                    break
+                new_resource = {}
+                blank_row = True
+                for col in model.Resource.get_columns() + ['id']:
+                    if col in base_columns:
+                        value = params.get('%s-%i-%s' % (self.name, row, col), u'')
+                    else:
+                        value = params.get('%s-%i-%s' % (self.name, row, col))
+                    new_resource[col] = value
+                    if col != 'id' and value:
+                        blank_row = False
+                if not blank_row:
+                    new_resources.append(new_resource)
+                row += 1
+            return new_resources
+
+


diff -r 70028607602410376f3a99cdad8c4b942e399996 -r bb9ad6fb8b4bbbf679fbb42221473b4c998eaf54 ckanext/dgu/tests/forms/test_form_api_gov3.py
--- a/ckanext/dgu/tests/forms/test_form_api_gov3.py
+++ b/ckanext/dgu/tests/forms/test_form_api_gov3.py
@@ -70,7 +70,6 @@
         self.assert_formfield(form, 'Package--resources-0-url', '')
         self.assert_formfield(form, 'Package--resources-0-format', '')
         self.assert_formfield(form, 'Package--resources-0-description', '')
-        self.assert_formfield(form, 'Package--resources-0-hash', '')
         self.assert_formfield(form, 'Package--resources-0-id', '')
         self.assert_formfield(form, 'Package--author', '')
         self.assert_formfield(form, 'Package--author_email', '')



https://bitbucket.org/okfn/ckanext-dgu/changeset/c60102484db1/
changeset:   c60102484db1
user:        Ian Murray
date:        2011-11-04 11:12:51
summary:     Skip a test that fails when run against sqlite.

When run against a sqlite backend, sqlalchemy fails to convert a revision
timestamp to a python datetime object.  Judged OK to skip this as
the full tests (against postgresql) will run this correctly.
affected #:  1 file

diff -r bb9ad6fb8b4bbbf679fbb42221473b4c998eaf54 -r c60102484db119fd4619ec476043c609eacadd6d ckanext/dgu/tests/bin/test_change_licenses.py
--- a/ckanext/dgu/tests/bin/test_change_licenses.py
+++ b/ckanext/dgu/tests/bin/test_change_licenses.py
@@ -6,6 +6,7 @@
 from ckan.tests.wsgi_ckanclient import WsgiCkanClient
 from ckan.lib.create_test_data import CreateTestData
 
+from pylons import config
 
 class TestChangeLicenses(TestController):
     @classmethod
@@ -27,6 +28,10 @@
         return dict([(pkg.name, pkg.license_id) for pkg in q.all()])
 
     def test_1_change_all_pkgs(self):
+
+        if 'sqlite' in config.get('sqlalchemy.url'):
+            raise SkipTest
+
         licenses_before = self.get_licenses()
         self.license_id = 'test-license'
         self.change_licenses = ChangeLicenses(self.testclient)



https://bitbucket.org/okfn/ckanext-dgu/changeset/5c6b413d004c/
changeset:   5c6b413d004c
user:        Ian Murray
date:        2011-11-04 18:10:44
summary:     Fixed broken test setup.

Rendering of the 'package/read.html' template in the test setup was failing
due to the template needing access to the routes_dict.
affected #:  1 file

diff -r c60102484db119fd4619ec476043c609eacadd6d -r 5c6b413d004c456ba2fa9bd93c583b6c80ea5400 ckanext/dgu/tests/functional/test_filters.py
--- a/ckanext/dgu/tests/functional/test_filters.py
+++ b/ckanext/dgu/tests/functional/test_filters.py
@@ -35,6 +35,15 @@
                    'user': c.user,
                    'package':c.pkg}
         c.pkg_dict = get.package_show(context, {'id':c.pkg.id})
+
+        # inject a mock-routes_dict into the environ in order
+        # that the template can be rendered correctly.
+        # See 'ckan/templates/layout_base.html'
+        import pylons
+        pylons.request.environ.update({'pylons.routes_dict': {
+            'action': 'test-action',
+            'controller': 'test-package::',
+        }})
         
         # Render package view page
         # (filter should not be called on this occasion)



https://bitbucket.org/okfn/ckanext-dgu/changeset/89ce2abacfa5/
changeset:   89ce2abacfa5
user:        Ian Murray
date:        2011-11-04 18:19:29
summary:     Fixed broken TestGeoCoverageBug

Due to the order of declaration of the inherited classes, the wrong
value of ref_package_by was inherited.  Rather than inheriting "id"
from `Api2TestCase`, " " was inherited from `BaseFormsApiCase`.
affected #:  1 file

diff -r 5c6b413d004c456ba2fa9bd93c583b6c80ea5400 -r 89ce2abacfa5d5568b221c3bb4c8010867b6b5f8 ckanext/dgu/tests/functional/test_package_gov3.py
--- a/ckanext/dgu/tests/functional/test_package_gov3.py
+++ b/ckanext/dgu/tests/functional/test_package_gov3.py
@@ -196,7 +196,7 @@
 
 class TestEmbeddedFormApi2(Api2TestCase, EmbeddedFormTestCase): pass
 
-class TestGeoCoverageBug(BaseFormsApiCase, Api2TestCase, MockDrupalCase):
+class TestGeoCoverageBug(Api2TestCase, BaseFormsApiCase, MockDrupalCase):
     @classmethod
     def setup(self):
         self.user_name = u'tester1'



https://bitbucket.org/okfn/ckanext-dgu/changeset/d9773267b9ca/
changeset:   d9773267b9ca
user:        Ian Murray
date:        2011-11-04 18:27:18
summary:     Fixed failing functional tests: removed check for resource field that deosn't exist on the form.

I should have removed this line in 328:bb9ad6fb8b4b
affected #:  1 file

diff -r 89ce2abacfa5d5568b221c3bb4c8010867b6b5f8 -r d9773267b9cae79d83783609db2dc4d1e32b94ab ckanext/dgu/tests/functional/test_package_gov3.py
--- a/ckanext/dgu/tests/functional/test_package_gov3.py
+++ b/ckanext/dgu/tests/functional/test_package_gov3.py
@@ -43,7 +43,6 @@
         self.assert_formfield(form, 'Package--resources-0-url', '')
         self.assert_formfield(form, 'Package--resources-0-format', '')
         self.assert_formfield(form, 'Package--resources-0-description', '')
-        self.assert_formfield(form, 'Package--resources-0-hash', '')
         self.assert_formfield(form, 'Package--resources-0-id', '')
         self.assert_formfield(form, 'Package--author', '')
         self.assert_formfield(form, 'Package--author_email', '')



https://bitbucket.org/okfn/ckanext-dgu/changeset/7d0913f12758/
changeset:   7d0913f12758
user:        Ian Murray
date:        2011-11-07 14:33:54
summary:     Ensure TestDeleteDecoyWhenAdmin cleans up after itself.

The test class was not cleaning up after itself, and was leaving a package entity
in solr.
affected #:  1 file

diff -r d9773267b9cae79d83783609db2dc4d1e32b94ab -r 7d0913f12758a962dfc2d52f63802ce2639d4291 ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -502,7 +502,9 @@
 
     @classmethod
     def teardown(self):
-        pass
+        user = model.User.by_name(u'testsysadmin')
+        testclient_admin = WsgiCkanClient(self.app, api_key=user.apikey)
+        testclient_admin.package_entity_delete(package_name=self.pkg_dict['name'])
 
     def test_load(self):
         user = model.User.by_name(u'testsysadmin')



https://bitbucket.org/okfn/ckanext-dgu/changeset/62c75ea4f89c/
changeset:   62c75ea4f89c
user:        Ian Murray
date:        2011-11-08 12:51:07
summary:     Fixed broken test_ons_loader tests.

Package fixtures were missing required Group fixtures in order
for them to be created.
affected #:  1 file

diff -r 7d0913f12758a962dfc2d52f63802ce2639d4291 -r 62c75ea4f89cccc1a20af74e373e8da485eee3ac ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -37,6 +37,7 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadBasic, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
         importer_ = importer.OnsImporter(sample_filepath(''))
         self.pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]
 
@@ -147,6 +148,7 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadTwice, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
         # sample_filepath(2 has the same packages as 1, but slightly updated
         for filepath in [sample_filepath(''), sample_filepath(2)]:
             importer_ = importer.OnsImporter(filepath)
@@ -173,6 +175,7 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadClashTitle, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
         # ons items have been split into 3 files, because search needs to
         # do indexing in between
         for suffix in 'abc':
@@ -206,6 +209,7 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadClashSource, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
 
         self.clash_name = u'cereals_and_oilseeds_production_harvest'
         CreateTestData.create_arbitrary([
@@ -235,6 +239,7 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadSeries, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
         for filepath in [sample_filepath('4a'), sample_filepath('4b')]:
             importer_ = importer.OnsImporter(filepath)
             pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]
@@ -295,6 +300,7 @@
     @classmethod
     def setup_class(self):
         super(TestNationalParkDuplicate, self).setup_class()
+        self.testclient.group_register_post({'name': 'ukgov'})
         filepath = sample_filepath(6)
         importer_ = importer.OnsImporter(filepath)
         pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]



https://bitbucket.org/okfn/ckanext-dgu/changeset/a13e77dac963/
changeset:   a13e77dac963
user:        Ian Murray
date:        2011-11-08 13:20:21
summary:     Ensure test_ons_loader.py tests are working on a clean index.
affected #:  1 file

diff -r 62c75ea4f89cccc1a20af74e373e8da485eee3ac -r a13e77dac963ceb6a6bb455f99fca0e96e2d7c0a ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -9,6 +9,7 @@
 from ckanext.dgu.ons.loader import OnsLoader
 from ckanext.importlib.tests.test_loader import TestLoaderBase, USER
 from ckan import model
+from ckan.lib import search
 from ckan.tests import CreateTestData, TestSearchIndexer, is_search_supported
 from ckan.tests.wsgi_ckanclient import WsgiCkanClient
 from ckanext.dgu.tests import MockDrupalCase
@@ -25,6 +26,7 @@
 class OnsLoaderBase(TestLoaderBase, MockDrupalCase):
     @classmethod
     def setup_class(self):
+        search.clear()
         super(OnsLoaderBase, self).setup_class()
 
     @classmethod



https://bitbucket.org/okfn/ckanext-dgu/changeset/55d3240b9346/
changeset:   55d3240b9346
user:        Ian Murray
date:        2011-11-08 13:32:59
summary:     Changed the way TestDeletedDecoyWhenAdmin cleans up after itself
affected #:  1 file

diff -r a13e77dac963ceb6a6bb455f99fca0e96e2d7c0a -r 55d3240b93460363d26bf7a65df91b41dcb9cbf3 ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -510,9 +510,7 @@
 
     @classmethod
     def teardown(self):
-        user = model.User.by_name(u'testsysadmin')
-        testclient_admin = WsgiCkanClient(self.app, api_key=user.apikey)
-        testclient_admin.package_entity_delete(package_name=self.pkg_dict['name'])
+        search.clear()
 
     def test_load(self):
         user = model.User.by_name(u'testsysadmin')



https://bitbucket.org/okfn/ckanext-dgu/changeset/ade3607f8868/
changeset:   ade3607f8868
user:        Ian Murray
date:        2011-11-08 13:51:06
summary:     [merge]
affected #:  4 files



diff -r 55d3240b93460363d26bf7a65df91b41dcb9cbf3 -r ade3607f88689c8bce0ea3e86a4b0a6cfd5bcb79 ckanext/dgu/ons/importer.py
--- a/ckanext/dgu/ons/importer.py
+++ b/ckanext/dgu/ons/importer.py
@@ -136,7 +136,7 @@
             'notes': notes,
             'license_id': self._crown_license_id,
             'tags': [], # post-filled
-            'groups': ['ukgov'],
+            'groups': [],
             'resources': resources,
             'extras': extras,
             }


diff -r 55d3240b93460363d26bf7a65df91b41dcb9cbf3 -r ade3607f88689c8bce0ea3e86a4b0a6cfd5bcb79 ckanext/dgu/tests/ons/test_ons_importer.py
--- a/ckanext/dgu/tests/ons/test_ons_importer.py
+++ b/ckanext/dgu/tests/ons/test_ons_importer.py
@@ -187,7 +187,7 @@
             ('notes', u"Monthly breakdown for government's net reserves, detailing gross reserves and gross liabilities.\n\nSource agency: HM Treasury\n\nLanguage: English\n\nAlternative title: UK Reserves"),
             ('license_id', u'uk-ogl'),
             ('tags', [u'assets', u'currency', u'economics-and-finance', u'economy', u'gold', u'government-receipts-and-expenditure', u'liabilities', u'public-sector-finance', u'reserves']),
-            ('groups', ['ukgov']),
+            ('groups', []),
             ('resources', [OrderedDict([
                 ('url', u'http://www.hm-treasury.gov.uk/national_statistics.htm'),
                 ('description', u'December 2009 | hub/id/119-36345'),


diff -r 55d3240b93460363d26bf7a65df91b41dcb9cbf3 -r ade3607f88689c8bce0ea3e86a4b0a6cfd5bcb79 ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -141,7 +141,6 @@
         assert cereals.author == u'Department for Environment, Food and Rural Affairs', cereals.author
         assert custody.author == u'Ministry of Justice', custody.author
 
-#        assert model.Group.by_name(u'ukgov') in pkg1.groups
         for pkg in (pkg1, cereals, custody):
             assert pkg.extras['import_source'].startswith('ONS'), '%s %s' % (pkg.name, pkg.extras['import_source'])
 
@@ -278,7 +277,7 @@
              "notes": "This report reviews:\n\nWhat is subjective wellbeing and why should we measure it?\n\nHow subjective wellbeing is currently measured in the UK - what subjective wellbeing questions are already being asked on major social surveys in the UK\n\nThe potential uses of subjective wellbeing data collected via these surveys\n\n\nIt concludes that subjective wellbeing is a valid construct that can be measured reliably. This is the first output of ONS' work on subjective wellbeing.\n\nSource agency: Office for National Statistics\n\nDesignation: Supporting material\n\nLanguage: English\n\nAlternative title: Working Paper: Measuring Subjective Wellbeing in the UK",
              "license_id": "ukcrown-withrights",
              "tags": ["communities", "health-well-being-and-care", "people-and-places", "societal-wellbeing", "subjective-wellbeing-subjective-well-being-objective-measures-subjective-measures", "well-being"],
-             "groups": ["ukgov"],
+             "groups": [],
              "extras": {"geographic_coverage": "111100: United Kingdom (England, Scotland, Wales, Northern Ireland)", "geographical_granularity": "UK and GB", "external_reference": "ONSHUB", "temporal_granularity": "", "date_updated": "", "agency": "Office for National Statistics", "precision": "", "temporal_coverage_to": "", "temporal_coverage_from": "", "national_statistic": "no", "import_source": "ONS-ons_data_7_days_to_2010-09-17", "department": 'UK Statistics Authority', "update_frequency": "", "date_released": "2010-09-14", "categories": "People and Places"},
              "resources": [{"url": "http://www.ons.gov.uk/about-statistics/measuring-equality/wellbeing/news-and-events/index.html", "format": "", "description": "2010 | hub/id/77-31166", }],
              }
@@ -335,7 +334,7 @@
             "notes": "Weekly death figures provide provisional counts of the number of deaths registered in England and Wales in the latest four weeks for which data are available up to the end of 2009. From week one 2010 the latest eight weeks for which data are available will be published.\n\nSource agency: Office for National Statistics\n\nDesignation: National Statistics\n\nLanguage: English\n\nAlternative title: Weekly deaths",
             "license_id": "ukcrown-withrights",
             "tags": ["death", "deaths", "life-events", "life-in-the-community", "mortality-rates", "population", "weekly-deaths"],
-            "groups": ["ukgov"], "extras": {
+            "groups": [], "extras": {
                 "geographic_coverage": "101000: England, Wales",
                 "geographical_granularity": "Country",
                 "external_reference": "ONSHUB",
@@ -389,7 +388,7 @@
             "notes": "The National Child Measurement Programme weighs and measures primary school children.\r\nThis publication was formerly announced as \"National Child Measurement Programme - Statistics on Child Obesity 2008-09\" but the title has been amended to reflect suggestions from the UKSA Assessments Board.\r\nSource agency: Information Centre for Health and Social Care\r\nDesignation: National Statistics\r\nLanguage: English\r\nAlternative title: National Child Measurement Programme",
             "license_id": "uk-ogl",
             "tags": ["health", "health-and-social-care", "health-of-the-population", "lifestyles-and-behaviours", "nhs", "well-being-and-care"],
-            "groups": ["ukgov"],
+            "groups": [],
             "extras": {
                 "geographic_coverage": "100000: England",
                 "geographical_granularity": "Country",
@@ -455,7 +454,7 @@
             "notes": "Epidemiological analyses of Mandatory surveillance data on MRSA bacteraemia and C. difficile infection covering at least nine quarters\r\nSource agency: Health Protection Agency\r\nDesignation: Official Statistics not designated as National Statistics\r\nLanguage: English\r\nAlternative title: Quarterly Epi Commentary",
             "license_id": "uk-ogl",
             "tags": ["conditions-and-diseases", "health", "health-and-social-care", "health-of-the-population", "nhs-trust-hcai-pct-mrsa-mrsa-bacteraemia-c-difficile-c-diff-clostridium-difficile-healthcare-associa", "well-being-and-care"],
-            "groups": ["ukgov"],
+            "groups": [],
             "extras": {
                 "geographic_coverage": "100000: England",
                 "geographical_granularity": "Other",



https://bitbucket.org/okfn/ckanext-dgu/changeset/45765abbbf33/
changeset:   45765abbbf33
user:        Ian Murray
date:        2011-11-08 15:25:17
summary:     [test filter] Skip test on sqlite
affected #:  1 file

diff -r ade3607f88689c8bce0ea3e86a4b0a6cfd5bcb79 -r 45765abbbf3399f52df583e67f927527edbe14d3 ckanext/dgu/tests/bin/test_national_statistic_filter.py
--- a/ckanext/dgu/tests/bin/test_national_statistic_filter.py
+++ b/ckanext/dgu/tests/bin/test_national_statistic_filter.py
@@ -1,5 +1,9 @@
 import copy
 
+from pylons import config
+
+from nose.plugins.skip import SkipTest
+
 from ckan import model
 from ckan.tests import TestController
 from ckan.tests.wsgi_ckanclient import WsgiCkanClient
@@ -63,6 +67,10 @@
         self.testclient = WsgiCkanClient(self.app, api_key=user.apikey)
 
     def test_filter(self):
+
+        if 'sqlite' in config.get('sqlalchemy.url'):
+            raise SkipTest
+
         ns_filter = NSFilter(self.testclient, dry_run=False, force=False)
         ns_filter.filter()
 



https://bitbucket.org/okfn/ckanext-dgu/changeset/1f24fd060114/
changeset:   1f24fd060114
user:        dread
date:        2011-11-10 11:38:55
summary:     [form, tests]: Minor tidy up and explanations of icmurray changes.
affected #:  5 files

diff -r 45765abbbf3399f52df583e67f927527edbe14d3 -r 1f24fd060114424155d1a60f37f87d1c7ac06682 ckanext/dgu/forms/package_gov3.py
--- a/ckanext/dgu/forms/package_gov3.py
+++ b/ckanext/dgu/forms/package_gov3.py
@@ -130,6 +130,10 @@
         is_admin=is_admin, user_editable_groups=user_editable_groups,
         publishers=publishers, **kwargs).get_fieldset()
 
+# ResourcesField copied into here from ckan/forms/common.py so that
+# the rendered fields (c.columns) can be fixed, to avoid issues with
+# the new fields that have appeared since. Also, this form will not
+# be around much longer in either place in the code.
 class ResourcesField(ConfiguredField):
     '''A form field for multiple dataset resources.'''
 
@@ -153,13 +157,13 @@
                 not_nothing_validator(value, field)
             
     def get_configured(self):
-        field = self._ResourcesField(self.name).with_renderer(self.ResourcesRenderer).validate(self.resource_validator)
+        field = self.ResourcesField_(self.name).with_renderer(self.ResourcesRenderer).validate(self.resource_validator)
         field._hidden_label = self._hidden_label
         field.fields_required = self.fields_required
         field.set(multiple=True)
         return field
 
-    class _ResourcesField(formalchemy.Field):
+    class ResourcesField_(formalchemy.Field):
         def sync(self):
             if not self.is_readonly():
                 pkg = self.model


diff -r 45765abbbf3399f52df583e67f927527edbe14d3 -r 1f24fd060114424155d1a60f37f87d1c7ac06682 ckanext/dgu/tests/bin/test_change_licenses.py
--- a/ckanext/dgu/tests/bin/test_change_licenses.py
+++ b/ckanext/dgu/tests/bin/test_change_licenses.py
@@ -28,8 +28,10 @@
         return dict([(pkg.name, pkg.license_id) for pkg in q.all()])
 
     def test_1_change_all_pkgs(self):
-
         if 'sqlite' in config.get('sqlalchemy.url'):
+            # Ian thinks this failed for him due to a timestamp not being converted
+            # to a datetime object, and being left as a unicode object.
+            # Could also be related to Sqlalchemy 0.7.x.
             raise SkipTest
 
         licenses_before = self.get_licenses()


diff -r 45765abbbf3399f52df583e67f927527edbe14d3 -r 1f24fd060114424155d1a60f37f87d1c7ac06682 ckanext/dgu/tests/bin/test_national_statistic_filter.py
--- a/ckanext/dgu/tests/bin/test_national_statistic_filter.py
+++ b/ckanext/dgu/tests/bin/test_national_statistic_filter.py
@@ -67,8 +67,10 @@
         self.testclient = WsgiCkanClient(self.app, api_key=user.apikey)
 
     def test_filter(self):
-
         if 'sqlite' in config.get('sqlalchemy.url'):
+            # Ian thinks this failed for him due to a timestamp not being converted
+            # to a datetime object, and being left as a unicode object.
+            # Could also be related to Sqlalchemy 0.7.x.
             raise SkipTest
 
         ns_filter = NSFilter(self.testclient, dry_run=False, force=False)


diff -r 45765abbbf3399f52df583e67f927527edbe14d3 -r 1f24fd060114424155d1a60f37f87d1c7ac06682 ckanext/dgu/tests/functional/test_filters.py
--- a/ckanext/dgu/tests/functional/test_filters.py
+++ b/ckanext/dgu/tests/functional/test_filters.py
@@ -39,6 +39,7 @@
         # inject a mock-routes_dict into the environ in order
         # that the template can be rendered correctly.
         # See 'ckan/templates/layout_base.html'
+        # (This is also fixed in ckan 1.5.1)
         import pylons
         pylons.request.environ.update({'pylons.routes_dict': {
             'action': 'test-action',


diff -r 45765abbbf3399f52df583e67f927527edbe14d3 -r 1f24fd060114424155d1a60f37f87d1c7ac06682 ckanext/dgu/tests/ons/test_ons_loader.py
--- a/ckanext/dgu/tests/ons/test_ons_loader.py
+++ b/ckanext/dgu/tests/ons/test_ons_loader.py
@@ -39,7 +39,6 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadBasic, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
         importer_ = importer.OnsImporter(sample_filepath(''))
         self.pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]
 
@@ -149,7 +148,6 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadTwice, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
         # sample_filepath(2 has the same packages as 1, but slightly updated
         for filepath in [sample_filepath(''), sample_filepath(2)]:
             importer_ = importer.OnsImporter(filepath)
@@ -176,7 +174,6 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadClashTitle, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
         # ons items have been split into 3 files, because search needs to
         # do indexing in between
         for suffix in 'abc':
@@ -210,7 +207,6 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadClashSource, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
 
         self.clash_name = u'cereals_and_oilseeds_production_harvest'
         CreateTestData.create_arbitrary([
@@ -240,7 +236,6 @@
     @classmethod
     def setup_class(self):
         super(TestOnsLoadSeries, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
         for filepath in [sample_filepath('4a'), sample_filepath('4b')]:
             importer_ = importer.OnsImporter(filepath)
             pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]
@@ -301,7 +296,6 @@
     @classmethod
     def setup_class(self):
         super(TestNationalParkDuplicate, self).setup_class()
-        self.testclient.group_register_post({'name': 'ukgov'})
         filepath = sample_filepath(6)
         importer_ = importer.OnsImporter(filepath)
         pkg_dicts = [pkg_dict for pkg_dict in importer_.pkg_dict()]

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

--

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