[ckan-changes] [okfn/ckan] 4ce167: Merge branch 'release-v1.7' of https://github.com/...

GitHub noreply at github.com
Mon Apr 30 08:42:56 UTC 2012


  Branch: refs/heads/release-v1.7
  Home:   https://github.com/okfn/ckan
  Commit: 4ce167c9601087326d6cae52e0fccb084a97346b
      https://github.com/okfn/ckan/commit/4ce167c9601087326d6cae52e0fccb084a97346b
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-27 (Fri, 27 Apr 2012)

  Changed paths:
    M doc/solr-setup.rst
    M doc/using-data-api.rst

  Log Message:
  -----------
  Merge branch 'release-v1.7' of https://github.com/okfn/ckan into release-v1.7


diff --git a/doc/solr-setup.rst b/doc/solr-setup.rst
index 4529797..3c158b2 100644
--- a/doc/solr-setup.rst
+++ b/doc/solr-setup.rst
@@ -71,7 +71,7 @@ so, create a symbolic link to the schema file in the config folder. Use the late
 supported by the CKAN version you are installing (it will generally be the highest one)::
 
  sudo mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.bak
- sudo ln -s ~/ckan/ckan/config/solr/schema-1.3.xml /etc/solr/conf/schema.xml
+ sudo ln -s ~/ckan/ckan/config/solr/schema-1.4.xml /etc/solr/conf/schema.xml
 
 Now restart jetty::
 
@@ -93,6 +93,7 @@ will have different paths in the Solr server URL::
 
  http://localhost:8983/solr/ckan-schema-1.2       # Used by CKAN up to 1.5
  http://localhost:8983/solr/ckan-schema-1.3       # Used by CKAN 1.5.1
+ http://localhost:8983/solr/ckan-schema-1.4       # Used by CKAN 1.7
  http://localhost:8983/solr/some-other-site  # Used by another site
 
 To set up a multicore Solr instance, repeat the steps on the previous section
diff --git a/doc/using-data-api.rst b/doc/using-data-api.rst
index 09caf21..50c7db2 100644
--- a/doc/using-data-api.rst
+++ b/doc/using-data-api.rst
@@ -2,22 +2,44 @@
 Using the Data API
 ==================
 
+The following provides an introduction to using the CKAN :doc:`DataStore
+<datastore>` Data API.
+
 Introduction
 ============
 
-The Data API builds directly on ElasticSearch, with a resource API endpoint
-being equivalent to a single index 'type' in ElasticSearch (we tend to refer to
-it as a 'table').  This means you can often directly re-use `ElasticSearch
-client libraries`_ when connecting to the API endpoint.
+Each 'table' in the DataStore is an ElasticSearch_ index type ('table'). As
+such the Data API for each CKAN resource is directly equivalent to a single
+index 'type' in ElasticSearch (we tend to refer to it as a 'table').
+
+This means you can (usually) directly re-use `ElasticSearch client libraries`_
+when connecting to a Data API endpoint. It also means that what follows is, in
+essence, a tutorial in using the ElasticSearch_ API.
+
+The following short set of slides provide a brief overview and introduction to
+the DataStore and the Data API.
 
-Furthermore, it means that what is presented below is essentially a tutorial in the ElasticSearch API.
+.. raw:: html
 
+   <iframe src="https://docs.google.com/presentation/embed?id=1UhEqvEPoL_VWO5okYiEPfZTLcLYWqtvRRmB1NBsWXY8&start=false&loop=false&delayms=3000" frameborder="0" width="480" height="389" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
+
+.. _ElasticSearch: http://elasticsearch.org/
 .. _ElasticSearch client libraries: http://www.elasticsearch.org/guide/appendix/clients.html
 
 Quickstart
 ==========
 
-``{{endpoint}}`` refers to the data API endpoint (or ElasticSearch index / table).
+``{{endpoint}}`` refers to the data API endpoint (or ElasticSearch index /
+table). For example, on the DataHub_ this gold prices data resource
+http://datahub.io/dataset/gold-prices/resource/b9aae52b-b082-4159-b46f-7bb9c158d013
+would have its Data API endpoint at:
+http://datahub.io/api/data/b9aae52b-b082-4159-b46f-7bb9c158d013. If you were
+just using ElasticSearch standalone an example of an endpoint would be:
+http://localhost:9200/gold-prices/monthly-price-table.
+
+.. note::  every resource on a CKAN instance for which a DataStore table is
+           enabled provides links to its Data API endpoint via the Data API
+           button at the top right of the resource page.
 
 Key urls:
 
@@ -28,6 +50,8 @@ Key urls:
 
 * Schema (Mapping): ``{{endpoint}}/_mapping``
 
+.. _DataHub: http://datahub.io/
+
 Examples
 --------
 


================================================================
  Commit: 7a0039be4fde8787cbe2c12124102eb2f5278d04
      https://github.com/okfn/ckan/commit/7a0039be4fde8787cbe2c12124102eb2f5278d04
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/logic/converters.py
    M ckan/templates/_snippet/data-api-help.html
    M ckan/templates/js_strings.html
    M ckanext/multilingual/plugin.py
    M doc/solr-setup.rst

  Log Message:
  -----------
  Merge branch 'release-v1.7' of https://github.com/okfn/ckan into release-v1.7


diff --git a/ckan/logic/converters.py b/ckan/logic/converters.py
index 6b927ae..18a67df 100644
--- a/ckan/logic/converters.py
+++ b/ckan/logic/converters.py
@@ -77,7 +77,8 @@ def callable(key, data, errors, context):
         for k in data.keys():
             if k[0] == 'tags':
                 if data[k].get('vocabulary_id') == v.id:
-                    tags.append(data[k]['name'])
+                    name = data[k].get('display_name', data[k]['name'])
+                    tags.append(name)
         data[key] = tags
     return callable
 
diff --git a/ckan/templates/_snippet/data-api-help.html b/ckan/templates/_snippet/data-api-help.html
index a387417..16349df 100644
--- a/ckan/templates/_snippet/data-api-help.html
+++ b/ckan/templates/_snippet/data-api-help.html
@@ -17,7 +17,7 @@
 <div class="modal-body">
   <p><strong>Access resource data via a web API with powerful query
     support</strong>. Further information in the <a
-    href="http://docs.ckan.org/en/latest/storage/datastore.html" target="_blank">main
+    href="http://docs.ckan.org/en/latest/using-data-api.html" target="_blank">main
     CKAN Data API and DataStore documentation</a>.</p>
 
   <div class="accordion-group">
diff --git a/ckan/templates/js_strings.html b/ckan/templates/js_strings.html
index 76a0d7e..a22ea2f 100644
--- a/ckan/templates/js_strings.html
+++ b/ckan/templates/js_strings.html
@@ -13,61 +13,62 @@
   /*
    * Used in application.js.
    */
-  CKAN.Strings.checking = "${_('Checking...')}";
-  CKAN.Strings.urlIsTooShort = "${_('Type at least two characters...')}";
-  CKAN.Strings.urlIsUnchanged = "${_('This is the current URL.')}";
-  CKAN.Strings.urlIsAvailable = "${_('This URL is available!')}";
-  CKAN.Strings.urlIsNotAvailable = "${_('This URL is already used, please use a different one.')}";
-  CKAN.Strings.failedToSave = "${_('Failed to save, possibly due to invalid data ')}";
-  CKAN.Strings.addDataset = "${_('Add Dataset')}";
-  CKAN.Strings.addGroup = "${_('Add Group')}";
-  CKAN.Strings.youHaveUnsavedChanges = "${_("You have unsaved changes. Make sure to click 'Save Changes' below before leaving this page.")}";
-  CKAN.Strings.loading = "${_('Loading...')}";
-  CKAN.Strings.noNameBrackets = "${_('(no name)')}";
-  CKAN.Strings.deleteThisResourceQuestion = "${_('Delete the resource \'%name%\'?')}";
-  CKAN.Strings.previewNotAvailableForDataType = "${_('Preview not available for data type: ')}";
-  CKAN.Strings.failedToGetCredentialsForUpload = "${_('Failed to get credentials for storage upload. Upload cannot proceed')}";
-  CKAN.Strings.checkingUploadPermissions = "${_('Checking upload permissions ...')}";
-  CKAN.Strings.uploadingFile = "${_('Uploading file ...')}";
-  CKAN.Strings.dataFile = "${_('Data File')}";
-  CKAN.Strings.api = "${_('API')}";
-  CKAN.Strings.visualization = "${_('Visualization')}";
-  CKAN.Strings.image = "${_('Image')}";
-  CKAN.Strings.metadata = "${_('Metadata')}";
-  CKAN.Strings.documentation = "${_('Documentation')}";
-  CKAN.Strings.code = "${_('Code')}";
-  CKAN.Strings.example = "${_('Example')}";
+  CKAN.Strings = ${
+    h.json.dumps(dict(
+      checking = _('Checking...'),
+      urlIsTooShort = _('Type at least two characters...'),
+      urlIsUnchanged = _('This is the current URL.'),
+      urlIsAvailable = _('This URL is available!'),
+      urlIsNotAvailable = _('This URL is already used, please use a different one.'),
+      failedToSave = _('Failed to save, possibly due to invalid data '),
+      addDataset = _('Add Dataset'),
+      addGroup = _('Add Group'),
+      youHaveUnsavedChanges = _("You have unsaved changes. Make sure to click 'Save Changes' below before leaving this page."),
+      loading = _('Loading...'),
+      noNameBrackets = _('(no name)'),
+      deleteThisResourceQuestion = _('Delete the resource \'%name%\'?'),
+      previewNotAvailableForDataType = _('Preview not available for data type: '),
+      failedToGetCredentialsForUpload = _('Failed to get credentials for storage upload. Upload cannot proceed'),
+      checkingUploadPermissions = _('Checking upload permissions ...'),
+      uploadingFile = _('Uploading file ...'),
+      dataFile = _('Data File'),
+      api = _('API'),
+      visualization = _('Visualization'),
+      image = _('Image'),
+      metadata = _('Metadata'),
+      documentation = _('Documentation'),
+      code = _('Code'),
+      example = _('Example'),
+
+      upload = _('Upload'),
+      cancel = _('Cancel'),
+      name = _('Name'),
+      description = _('Description'),
+      url = _('Url'),
+      format = _('Format'),
+      resourceType = _('Resource Type'),
+      datastoreEnabled = _('DataStore enabled'),
+      sizeBracketsBytes = _('Size (Bytes)'),
+      mimetype = _('Mimetype'),
+      created = _('Created'),
+      lastModified = _('Last Modified'),
+      mimetypeInner = _('Mimetype (Inner)'),
+      hash = _('Hash'),
+      id = _('ID'),
+      doneEditing = _('Done'),
+      resourceHasUnsavedChanges = _('This resource has unsaved changes.'),
+      edit = _('Edit'),
+      preview = _('Preview'),
+      resourceFormatPlaceholder = _('e.g. csv, html, xls, rdf, ...'),
+      unknown = _('Unknown'),
+      extraFields = _('Extra Fields'),
+      addExtraField = _('Add Extra Field'),
+      deleteResource = _('Delete Resource'),
+      youCanUseMarkdown = _('You can use %aMarkdown formatting%b here.'),
+      shouldADataStoreBeEnabled = _('Should a %aDataStore table and Data API%b be enabled for this resource?'),
+      datesAreInISO = _('Dates are in %aISO Format%b — eg. %c2012-12-25%d or %c2010-05-31T14:30%d.'),
+      dataFileUploaded = _('Data File (Uploaded)')
+    ), indent=4)}
 
-  /*
-   * Used in templates.js.
-   */
-  CKAN.Strings.upload = "${_('Upload')}";
-  CKAN.Strings.cancel = "${_('Cancel')}";
-  CKAN.Strings.name = "${_('Name')}";
-  CKAN.Strings.description = "${_('Description')}";
-  CKAN.Strings.url = "${_('Url')}";
-  CKAN.Strings.format = "${_('Format')}";
-  CKAN.Strings.resourceType = "${_('Resource Type')}";
-  CKAN.Strings.datastoreEnabled = "${_('DataStore enabled')}";
-  CKAN.Strings.sizeBracketsBytes = "${_('Size (Bytes)')}";
-  CKAN.Strings.mimetype = "${_('Mimetype')}";
-  CKAN.Strings.created = "${_('Created')}";
-  CKAN.Strings.lastModified = "${_('Last Modified')}";
-  CKAN.Strings.mimetypeInner = "${_('Mimetype (Inner)')}";
-  CKAN.Strings.hash = "${_('Hash')}";
-  CKAN.Strings.id = "${_('ID')}";
-  CKAN.Strings.doneEditing = "${_('Done')}";
-  CKAN.Strings.resourceHasUnsavedChanges = "${_('This resource has unsaved changes.')}";
-  CKAN.Strings.edit = "${_('Edit')}";
-  CKAN.Strings.preview = "${_('Preview')}";
-  CKAN.Strings.resourceFormatPlaceholder = "${_('e.g. csv, html, xls, rdf, ...')}";
-  CKAN.Strings.unknown = "${_('Unknown')}";
-  CKAN.Strings.extraFields = "${_('Extra Fields')}";
-  CKAN.Strings.addExtraField = "${_('Add Extra Field')}";
-  CKAN.Strings.deleteResource = "${_('Delete Resource')}";
-  CKAN.Strings.youCanUseMarkdown = "${_('You can use %aMarkdown formatting%b here.')}";
-  CKAN.Strings.shouldADataStoreBeEnabled = "${_('Should a %aDataStore table and Data API%b be enabled for this resource?')}";
-  CKAN.Strings.datesAreInISO = "${_('Dates are in %aISO Format%b — eg. %c2012-12-25%d or %c2010-05-31T14:30%d.')}";
-  CKAN.Strings.dataFileUploaded = "${_('Data File (Uploaded)')}";
 </script>
 
diff --git a/ckanext/multilingual/plugin.py b/ckanext/multilingual/plugin.py
index a4696bd..c050f57 100644
--- a/ckanext/multilingual/plugin.py
+++ b/ckanext/multilingual/plugin.py
@@ -75,7 +75,7 @@ def translate_data_dict(data_dict):
                 translated_flattened[key] = fallback_translations.get(
                         value, value)
 
-        elif isinstance(value, int):
+        elif isinstance(value, (int, dict)):
             translated_flattened[key] = value
 
         else:
diff --git a/doc/solr-setup.rst b/doc/solr-setup.rst
index 3c158b2..395da67 100644
--- a/doc/solr-setup.rst
+++ b/doc/solr-setup.rst
@@ -50,13 +50,12 @@ and the admin site::
 
  http://localhost:8983/solr/admin
 
-.. note:: If you get the message `Could not start Jetty servlet engine because no Java Development Kit (JDK) was found.` then you will have to edit /etc/profile and add this line to the end such as this to the end (adjusting the path for your machine's jdk install):
+.. note:: If you get the message ``Could not start Jetty servlet engine because no Java Development Kit (JDK) was found.`` then you will have to edit the ``JAVA_HOME`` setting in ``/etc/default/jetty`` (adjusting the path for your machine's JDK install):
 
     ``JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/``
 
 Now run::
 
-       export JAVA_HOME
        sudo service jetty start
 
 


================================================================
  Commit: c0ad052f4f311ccf53ba94c0eac6da61c8f0d22d
      https://github.com/okfn/ckan/commit/c0ad052f4f311ccf53ba94c0eac6da61c8f0d22d
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckanext/organizations/forms.py
    M ckanext/organizations/templates/organization_package_form.html

  Log Message:
  -----------
  Update to fix organization dataset form and resource upload


diff --git a/ckanext/organizations/forms.py b/ckanext/organizations/forms.py
index c14e5e1..de60afb 100644
--- a/ckanext/organizations/forms.py
+++ b/ckanext/organizations/forms.py
@@ -221,9 +221,9 @@ def package_form(self):
     def db_to_form_schema(self):
         '''This is an interface to manipulate data from the database
         into a format suitable for the form (optional)'''
-        schema = default_package_schema()
-        schema['groups']['capacity'] = [ ignore_missing, unicode ]
-        return schema
+        #schema = default_package_schema()
+        #schema['groups']['capacity'] = [ ignore_missing, unicode ]
+        #return schema
 
     def form_to_db_schema(self):
         schema = default_package_schema()
diff --git a/ckanext/organizations/templates/organization_package_form.html b/ckanext/organizations/templates/organization_package_form.html
index 82a4404..e5cd0ec 100644
--- a/ckanext/organizations/templates/organization_package_form.html
+++ b/ckanext/organizations/templates/organization_package_form.html
@@ -143,6 +143,49 @@
   <div class="instructions">
     <p>Upload or link data files, APIs and other materials related to your dataset.</p>
   </div>
+  <div class="row">
+    <div class="span4">
+      <ul class="resource-list resource-list-edit drag-drop-list">
+      </ul>
+      <ul class="resource-list resource-list-add">
+        <li><a href="#" class="js-resource-add">${h.icon('page_white_add')}New resource...</a></li>
+      </ul>
+    </div>
+    <div class="span8">
+      <div style="display: none;" class="resource-panel">
+        <button class="btn btn-danger resource-panel-close">x</button>
+        <div class="resource-details resource-add">
+          <ul class="nav nav-tabs">
+            <li><a data-toggle="tab" href="#link-file">Link to a file</a></li>
+            <li><a data-toggle="tab" href="#link-api">Link to an API</a></li>
+            <li><a data-toggle="tab" href="#upload-file">Upload a file</a></li>
+          </ul>
+          <div class="tab-content">
+            <div class="tab-pane" id="link-file">
+              <div class="form-inline js-add-url-form">
+                <label class="field_opt" for="url">File URL</label>
+                <input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/file.csv"/>
+                <input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
+              </div>
+            </div>
+            <div class="tab-pane" id="link-api">
+              <div class="form-inline js-add-api-form">
+                <label class="field_opt" for="url">API URL</label>
+                <input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/api/"/>
+                <input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
+              </div>
+            </div>
+            <div class="tab-pane" id="upload-file">
+              <div class="js-add-upload-form">
+              </div>
+              <div class="alert alert-block" style="display: none;"></div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+
   <div class="js-resource-edit-barebones">
     <!-- The resource editor deletes these fields and replaces them with a dynamic editor.
          They are required for the form to render correctly when not in resource-edit mode. -->
@@ -152,22 +195,6 @@
       </py:for>
     </py:for>
   </div>
-  <ul class="resource-list resource-list-edit drag-drop-list">
-  </ul>
-  <ul class="resource-list resource-list-add">
-    <li><a href="#" class="js-resource-add">${h.icon('page_white_add')}New resource...</a></li>
-  </ul>
-  <div style="display: none;" class="resource-panel">
-    <button class="btn btn-danger resource-panel-close">x</button>
-    <div class="resource-details resource-add">
-      <ul class="button-row">
-        <li><h4>Add a resource:</h4></li>
-        <li><button class="btn js-link-file">Link to a file</button></li>
-        <li><button class="btn js-link-api">Link to an API</button></li>
-        <li class="js-upload-file ckan-logged-in" style="display: none;"><button class="btn js-upload-file">Upload a file</button></li>
-      </ul>
-    </div>
-  </div>
 </fieldset>
 
 <fieldset class="tab-pane fade" id='further-information'>


================================================================
Compare: https://github.com/okfn/ckan/compare/ccd89d8...c0ad052


More information about the ckan-changes mailing list