[ckan-changes] [okfn/ckan] f28c33: Fixes to testing for language field on package

GitHub noreply at github.com
Mon Apr 30 07:45:38 UTC 2012


  Branch: refs/heads/feature-1650-language-field
  Home:   https://github.com/okfn/ckan
  Commit: f28c33cf85bfc00b083bcab9bd8b542b5d117830
      https://github.com/okfn/ckan/commit/f28c33cf85bfc00b083bcab9bd8b542b5d117830
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/logic/schema.py
    M ckan/model/package.py
    M ckan/templates/package/new_package_form.html
    M ckan/templates/package/read_core.html

  Log Message:
  -----------
  Fixes to testing for language field on package


diff --git a/ckan/lib/plugins.py b/ckan/lib/plugins.py
index 258e144..8906224 100644
--- a/ckan/lib/plugins.py
+++ b/ckan/lib/plugins.py
@@ -273,6 +273,7 @@ def setup_template_variables(self, context, data_dict):
 
         c.licences = [('', '')] + base.model.Package.get_license_options()
         c.is_sysadmin = authz.Authorizer().is_sysadmin(c.user)
+        c.default_language = config.get('ckan.default.package.language', 'en')
 
         if c.pkg:
             c.related_count = len(c.pkg.related)
diff --git a/ckan/logic/schema.py b/ckan/logic/schema.py
index 25157cf..a4fccb8 100644
--- a/ckan/logic/schema.py
+++ b/ckan/logic/schema.py
@@ -115,7 +115,7 @@ def default_package_schema():
         'maintainer_email': [ignore_missing, unicode],
         'license_id': [ignore_missing, unicode],
         'notes': [ignore_missing, unicode],
-        'language': [ignore_missing, unicode],        
+        'language': [ignore_missing, unicode],
         'url': [ignore_missing, unicode],#, URL(add_http=False)],
         'version': [ignore_missing, unicode, package_version_validator],
         'state': [ignore_not_package_admin, ignore_missing],
diff --git a/ckan/model/package.py b/ckan/model/package.py
index 6449d45..5a62e5c 100644
--- a/ckan/model/package.py
+++ b/ckan/model/package.py
@@ -45,7 +45,6 @@
         Column('type', types.UnicodeText),
 )
 
-
 vdm.sqlalchemy.make_table_stateful(package_table)
 package_revision_table = make_revisioned_table(package_table)
 
diff --git a/ckan/templates/package/new_package_form.html b/ckan/templates/package/new_package_form.html
index 6ea5813..b444f0f 100644
--- a/ckan/templates/package/new_package_form.html
+++ b/ckan/templates/package/new_package_form.html
@@ -9,7 +9,7 @@
 
 <xi:include href="../_util.html" />
 
-<input name="language" type="hidden" value="${data.get('language', 'en')}" />
+<input name="language" type="hidden" value="${data.get('language', c.default_language )}" />
 
 <div class="alert alert-error error-explanation" py:if="error_summary">
 <h2>Errors in form</h2>
diff --git a/ckan/templates/package/read_core.html b/ckan/templates/package/read_core.html
index 3faa7d0..f350351 100644
--- a/ckan/templates/package/read_core.html
+++ b/ckan/templates/package/read_core.html
@@ -97,7 +97,7 @@
         <tr py:if="c.harvest_catalogue_name">
           <td class="dataset-label">Harvest Source</td>
           <td class="dataset-details" i18n:msg="harvest_catalogue_name">
-            <a href="${c.harvest_dataset_url}">Dataset page</a> on 
+            <a href="${c.harvest_dataset_url}">Dataset page</a> on
             <a href="${c.harvest_catalogue_url}">${c.harvest_catalogue_name}</a>
           </td>
         </tr>


================================================================



More information about the ckan-changes mailing list