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

Bitbucket commits-noreply at bitbucket.org
Thu May 19 07:53:03 UTC 2011


2 new changesets in ckanext-dgu:

http://bitbucket.org/okfn/ckanext-dgu/changeset/006b5d6f4251/
changeset:   r268:006b5d6f4251
user:        dread
date:        2011-05-11 14:17:03
summary:     [cospread, ons]: #1060 Use hyphen in name of temporal_coverage-to/from field.
affected #:  4 files (360 bytes)

--- a/ckanext/dgu/cospread/cospread.py	Wed May 11 17:09:12 2011 +0100
+++ b/ckanext/dgu/cospread/cospread.py	Wed May 11 13:17:03 2011 +0100
@@ -279,8 +279,8 @@
             ('Date released', 'date_released'),
             ('Date updated', 'date_updated'),
             ('Date update future', 'date_update_future'),
-            ('Temporal Coverage - From', 'temporal_coverage_from'),
-            ('Temporal Coverage - To', 'temporal_coverage_to'),
+            ('Temporal Coverage - From', 'temporal_coverage-from'),
+            ('Temporal Coverage - To', 'temporal_coverage-to'),
             ]:
             form_value = row_dict.get(column)
             if isinstance(form_value, datetime.date):
@@ -293,7 +293,7 @@
                 match = re.match('(\d{4})/(\d{2})', form_value or '')
                 if match:
                     years = [int(year_str) for year_str in match.groups()]
-                    if extra_key.endswith('_to'):
+                    if extra_key.endswith('-to'):
                         form_value = str(field_types.DateType.add_centurys_to_two_digit_year(year=years[1], near_year=years[0]))
                     else:
                         form_value = str(years[0])


--- a/ckanext/dgu/ons/importer.py	Wed May 11 17:09:12 2011 +0100
+++ b/ckanext/dgu/ons/importer.py	Wed May 11 13:17:03 2011 +0100
@@ -80,8 +80,8 @@
             'agency': u'',
             'precision': u'',
             'geographical_granularity': u'',
-            'temporal_coverage_from': u'',
-            'temporal_coverage_to': u'',
+            'temporal_coverage-from': u'',
+            'temporal_coverage-to': u'',
             'national_statistic': u'',
             'department': u'',
             'update_frequency': u'',


--- a/ckanext/dgu/tests/cospread/test_cospread.py	Wed May 11 17:09:12 2011 +0100
+++ b/ckanext/dgu/tests/cospread/test_cospread.py	Wed May 11 13:17:03 2011 +0100
@@ -164,8 +164,8 @@
         ('date_updated', '2009-09-17'),
         ('date_update_future', ''),
         ('temporal_granularity', 'year'),
-        ('temporal_coverage_to', ''),
-        ('temporal_coverage_from', ''),
+        ('temporal_coverage-to', ''),
+        ('temporal_coverage-from', ''),
         ('geographic_coverage', '100000: England'),
         ('geographical_granularity', 'local authority'),
 #        ('agency', u''),
@@ -286,8 +286,8 @@
         ('date_updated', ''),
         ('date_update_future', ''),
         ('temporal_granularity', ''),
-        ('temporal_coverage_to', '2009'),
-        ('temporal_coverage_from', '2002'),
+        ('temporal_coverage-to', '2009'),
+        ('temporal_coverage-from', '2002'),
         ('geographic_coverage', '100000: England'),
         ('geographical_granularity', 'Local Authority (District)'),
 #        ('agency', u''),
@@ -317,8 +317,8 @@
         ('geographical_granularity', 'CPS Area'),
         ('geographic_coverage', u'101000: England, Wales'),
         ('temporal_granularity', 'month'),
-        ('temporal_coverage_from', 'Months'),         
-        ('temporal_coverage_to', u''),
+        ('temporal_coverage-from', 'Months'),         
+        ('temporal_coverage-to', u''),
         ('published_by', u'Department for Education [some_number]'),
         ('published_via', u'Ealing PCT [some_number]'),
         ('taxonomy_url', ''),


--- a/ckanext/dgu/tests/ons/test_ons_importer.py	Wed May 11 17:09:12 2011 +0100
+++ b/ckanext/dgu/tests/ons/test_ons_importer.py	Wed May 11 13:17:03 2011 +0100
@@ -8,7 +8,7 @@
 from ckanext.dgu.ons import importer
 from ckanext.dgu.ons.producers import get_ons_producers
 from ckanext.dgu.schema import DrupalHelper
-from ckanext.dgu.tests import MockDrupalCase, strip_organisation_id
+from ckanext.dgu.tests import MockDrupalCase, strip_organisation_id, PackageDictUtil
 
 TEST_DIR = os.path.dirname(os.path.abspath(__file__))
 SAMPLE_PATH = os.path.join(TEST_DIR, 'samples')
@@ -200,8 +200,8 @@
                 ('date_updated', u''),
                 ('agency', u''),
                 ('precision', u''),
-                ('temporal_coverage_to', u''),
-                ('temporal_coverage_from', u''),
+                ('temporal_coverage-to', u''),
+                ('temporal_coverage-from', u''),
                 ('national_statistic', 'no'),
                 ('update_frequency', 'monthly'),
                 ('department', u"Her Majesty's Treasury"),
@@ -213,16 +213,7 @@
                 ('published_via', u''),
                 ])),
             ])
-        for key, value in expected_package_dict.items():
-            if key != 'extras':
-                assert_equal(package_dict[key], value)
-            else:
-                for key, expected_value in expected_package_dict['extras'].items():
-                    # take out any ids
-                    value = strip_organisation_id(package_dict['extras'][key])
-                    assert_equal(value, expected_value)
-        expected_keys = set(expected_package_dict.keys())
-        keys = set(package_dict.keys())
-        key_difference = expected_keys - keys
-        assert not key_difference, key_difference
+        for extra_key in ('published_by', 'published_via'):
+            package_dict['extras'][extra_key] = strip_organisation_id(package_dict['extras'][extra_key])
+        PackageDictUtil.check_dict(package_dict, expected_package_dict)
 


http://bitbucket.org/okfn/ckanext-dgu/changeset/f5fa31e927e6/
changeset:   r269:f5fa31e927e6
user:        dread
date:        2011-05-19 09:51:46
summary:     [middleware][s]: Fix occasional moment when cookie_string is not coming back as string.
affected #:  1 file (10 bytes)

--- a/ckanext/dgu/middleware.py	Wed May 11 13:17:03 2011 +0100
+++ b/ckanext/dgu/middleware.py	Thu May 19 08:51:46 2011 +0100
@@ -9,7 +9,7 @@
 
 def drupal_extract_cookie(cookie_string):
     cookies = Cookie.SimpleCookie()
-    cookies.load(cookie_string)
+    cookies.load(str(cookie_string))
     for cookie in cookies:
         if cookie.startswith('SESS'):
             return cookies[cookie].value
@@ -17,7 +17,7 @@
 
 def is_ckan_signed_in(cookie_string):
     cookies = Cookie.SimpleCookie()
-    cookies.load(cookie_string)
+    cookies.load(str(cookie_string))
     if not 'auth_tkt' in cookies:
         return False
     return True

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