[ckan-changes] commit/ckan: 10 new changesets

Bitbucket commits-noreply at bitbucket.org
Tue Sep 13 10:53:56 UTC 2011


10 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/2f52bce12abd/
changeset:   2f52bce12abd
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 10:51:46
summary:     [scripts][xs]: remove flexitable and css and js as no longer needed.
affected #:  2 files (0 bytes)

--- a/ckan/public/css/flexitable.css	Tue Sep 13 08:54:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-table.flexitable .controls {
-	padding: 0;
-	width: 4em;
-}
-
-table.flexitable input[type="url"] {
-  width: auto;
-}
-
-form .resource-hash, form .resource-id {
-  display: none;
-}
-
-table.flexitable .controls a {
-	float: left;
-	display: block;
-	height: 16px;
-	width: 16px;
-	margin: 0 0.3em 0 0;
-	padding: 0;
-	background-color: transparent;
-	background-repeat: no-repeat;
-	background-position: left top;
-	overflow: hidden;
-	text-indent: -999em;
-	letter-spacing: -1000em;
-}
-
-table.flexitable .controls a:last-child {
-	margin-right: 0;
-}
-
-table.flexitable .controls a.remove { background-image: url(../images/icons/remove.png); }
-/*.flexitable .controls .move { 
-	background-image: url(../images/icons/handle_grey.png);
-	cursor: move;
-}*/
-table.flexitable .controls a.moveUp { background-image: url(../images/icons/arrow_up.png); }
-table.flexitable .controls a.moveDown { background-image: url(../images/icons/arrow_down.png); }
-
-p.flexitable button.addRow {
-	background-image: url(../images/icons/add.png);
-	background-position: 0.4em 0.4em;
-	background-repeat: no-repeat;
-	padding-left: 1.7em;
-}
-
-button.addRow {
-        float: right;
-}


--- a/ckan/public/scripts/flexitable.js	Tue Sep 13 08:54:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/* flexitable.js
-  
-   TODO:
-   - replace separate moveUp/moveDown buttons with a drag handle.
-*/
-
-(function ($) {
-
-  var fieldNameRegex = /^(\S+)__(\d+)__(\S+)$/;
-
-  var controlsHtml = '<td><div class="controls">' +
-                       '<a class="moveUp"   title="Move this row up" href="#moveUp">Move up</a>' +
-                       '<a class="moveDown" title="Move this row down" href="#moveDown">Move down</a>' +
-                       '<a class="remove"   title="Remove this row" href="#remove">Remove row</a>' +
-                     '</div></td>';
-  
-  var addRowHtml = '<p class="flexitable"><button class="addRow">' + MSG_ADD_ROW + '</button></p>';
-
-  function getRowNumber(tr) {
-    var rowNumber = $(tr).find('input').attr('name').match(fieldNameRegex)[2];
-    return parseInt(rowNumber, 10);
-  }
-
-  function setRowNumber(tr, num) {
-    $(tr).find('input').each(function () {
-      $(this).attr({
-        id:   $(this).attr('id').replace(fieldNameRegex, "$1__" + num + "__$3"),
-        name: $(this).attr('name').replace(fieldNameRegex, "$1__" + num + "__$3")
-      });
-    });
-  }
-  
-  // Currently only supports -1 or 1 for up or down respectively.
-  function moveRow(row, offset) {
-    row = $(row);
-    var movingUp = (offset < 0),
-        swapWith = movingUp ? 'prev' : 'next',
-        swapHow  = movingUp ? 'after' : 'before',
-        swapEl = row[swapWith](),
-        rowNum = getRowNumber(row);
-
-    if (swapEl[0]) {
-      row[swapHow](swapEl);
-
-      setRowNumber(row, rowNum + offset);
-      setRowNumber(swapEl, rowNum);
-    }
-  }
-  
-  function addRow (e) {
-    e.preventDefault();
-    var table = $(this).parents('p').eq(0).prev(),
-        lastRow = table.find('tr:last'),
-        clone = lastRow.clone(true);
-
-    clone.insertAfter(lastRow).find('input').val('');
-    setRowNumber(clone, getRowNumber(lastRow) + 1);
-    return false;
-  }
-  
-  function removeRow () {
-    if (confirm('Are you sure you wish to remove this row?')) {
-      var row = $(this).parents('tr'),
-          following = row.nextAll();
-          prev = row.prevAll();
-
-      if (following.length + prev.length  == 0) {
-          row.find('input').val('')
-          return
-      }
-      row.remove();
-      following.each(function () {
-        setRowNumber(this, getRowNumber(this) - 1);
-      });
-    }
-    return false;
-  }
-
-  $(document).ready(function () {
-    $('.flexitable').find('tbody tr').append(controlsHtml).end()
-
-                    .find('a.moveUp').click(function () {
-                      moveRow($(this).parents('tr')[0], -1);
-                      return false;
-                    }).end()
-
-                    .find('a.moveDown').click(function () {
-                      moveRow($(this).parents('tr')[0], 1);
-                      return false;
-                    }).end()
-                    
-                    .find('a.remove').click(removeRow).end()
-                    
-                    .after(addRowHtml)
-                    .next().find('button.addRow').click(addRow);
-  });
-
-})(jQuery);


http://bitbucket.org/okfn/ckan/changeset/dcb21f0d976f/
changeset:   dcb21f0d976f
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 11:30:39
summary:     [theme][s]: (refs #1300) move all js to bottom of page yielding faster page load times (~0.5s by my crude estimates).

* NB: this means that, going forward, theme developer must use optional_footer to add js to the page.
affected #:  3 files (56 bytes)

--- a/ckan/templates/layout_base.html	Tue Sep 13 09:51:46 2011 +0100
+++ b/ckan/templates/layout_base.html	Tue Sep 13 10:30:39 2011 +0100
@@ -38,40 +38,6 @@
   <![endif]--><link rel="stylesheet" href="${g.site_url}/css/style.css?v=2" /><link rel="stylesheet" href="${g.site_url}/css/forms.css" type="text/css" media="screen, print" />
-  
-  <script type="text/javascript" src="${g.site_url}/language.js"></script>
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
-  <!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.6.2/jquery.js'>\x3C/script>")]]></script-->
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.tmpl/beta1/jquery.tmpl.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.cookie/jquery.cookie.min.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.placeholder/jquery.placeholder.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jqueryui/1.8.11/jquery-ui.min.js"></script>
-  <!-- for ckanjs etc -->
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/underscore/1.1.6/underscore.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/backbone/0.5.1/backbone.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/showdown/showdown.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.iframe-transport.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.fileupload.js"></script>
-  <script src="https://raw.github.com/okfn/ckanjs/master/pkg/ckanjs.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/ckanjs.js"></script>
-  <!-- finally our application js that sets everything up-->
-  <script type="text/javascript" src="${g.site_url}/scripts/application.js?lang=${c.locale}"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/templates.js"></script>
-
-
-  <script src="${g.site_url}/scripts/vendor/modernizr/1.7/modernizr.min.js"></script>
-
-  <script type="text/javascript">
-    $(document).ready(function() {
-        var ckan_user = $.cookie("ckan_display_name");
-        if (ckan_user) {
-            $(".ckan-logged-out").hide();
-            $(".ckan-logged-in").show();
-        }
-        $('input[placeholder], textarea[placeholder]').placeholder();
-    });
-  </script><py:if test="defined('optional_head')">
     ${optional_head()}
@@ -235,6 +201,38 @@
     </footer></div><!-- eo #container -->
 
+  <script type="text/javascript" src="${g.site_url}/language.js"></script>
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+  <!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.6.2/jquery.js'>\x3C/script>")]]></script-->
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.tmpl/beta1/jquery.tmpl.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.cookie/jquery.cookie.min.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.placeholder/jquery.placeholder.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jqueryui/1.8.11/jquery-ui.min.js"></script>
+  <!-- for ckanjs etc -->
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/underscore/1.1.6/underscore.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/backbone/0.5.1/backbone.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/showdown/showdown.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.iframe-transport.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.fileupload.js"></script>
+  <script src="https://raw.github.com/okfn/ckanjs/master/pkg/ckanjs.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/ckanjs.js"></script>
+  <!-- finally our application js that sets everything up-->
+  <script type="text/javascript" src="${g.site_url}/scripts/application.js?lang=${c.locale}"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/templates.js"></script>
+
+  <script src="${g.site_url}/scripts/vendor/modernizr/1.7/modernizr.min.js"></script>
+
+  <script type="text/javascript">
+    $(document).ready(function() {
+        var ckan_user = $.cookie("ckan_display_name");
+        if (ckan_user) {
+            $(".ckan-logged-out").hide();
+            $(".ckan-logged-in").show();
+        }
+        $('input[placeholder], textarea[placeholder]').placeholder();
+    });
+  </script><py:if test="defined('optional_footer')">
     ${optional_footer()}


--- a/ckan/templates/package/new.html	Tue Sep 13 09:51:46 2011 +0100
+++ b/ckan/templates/package/new.html	Tue Sep 13 10:30:39 2011 +0100
@@ -8,7 +8,7 @@
 
   <py:def function="body_class">hide-sidebar</py:def>
 
-  <py:def function="optional_head">
+  <py:def function="optional_footer"><!-- Reveal instructions --><script type="text/javascript" src="${g.site_url}/scripts/reveal_instructions.js"></script><link rel="stylesheet" href="${g.site_url}/css/reveal_instructions.css" /> 


--- a/ckan/templates/user/login.html	Tue Sep 13 09:51:46 2011 +0100
+++ b/ckan/templates/user/login.html	Tue Sep 13 10:30:39 2011 +0100
@@ -6,6 +6,8 @@
   <py:def function="optional_head"><!-- Simple OpenID Selector --><link rel="stylesheet" href="${g.site_url}/scripts/vendor/openid-selector/css/openid.css" />
+  </py:def>
+  <py:def function="optional_footer"><script type="text/javascript" src="${g.site_url}/scripts/vendor/openid-selector/js/openid-jquery.js"></script><script type="text/javascript">
       $(document).ready(function() {


http://bitbucket.org/okfn/ckan/changeset/c52ced686c91/
changeset:   c52ced686c91
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 11:43:58
summary:     [js,package/new][s]: simplify instructions on package new and remove reveal_instructions stuff as no longer needed.

* Was now only using reveal_instructions stuff on package/new page (no longer on edit it seems) and with simplification no longer needed.
affected #:  4 files (567 bytes)

--- a/ckan/public/css/reveal_instructions.css	Tue Sep 13 10:30:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-fieldset span.as_hyperlink {
-  text-decoration: underline;
-  color: blue;
-  cursor: pointer; }
-


--- a/ckan/public/scripts/reveal_instructions.js	Tue Sep 13 10:30:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-(function ($) {
-  $(document).ready(function () {
-    $('fieldset .basic').each(function() {
-        var basic = $(this);
-        var further = basic.next('.further');
-        if (further.length) {
-            var more = $('<span class="more"> <span class="as_hyperlink">' + MSG_MORE_HELP + '</span></span>');
-            basic.append(more);
-            further.hide();
-            more.click(function(){
-                further.slideDown('fast');
-                $(this).hide()
-            });
-        };
-    });
-  })
-})(jQuery);


--- a/ckan/templates/package/new.html	Tue Sep 13 10:30:39 2011 +0100
+++ b/ckan/templates/package/new.html	Tue Sep 13 10:43:58 2011 +0100
@@ -9,10 +9,6 @@
   <py:def function="body_class">hide-sidebar</py:def><py:def function="optional_footer">
-    <!-- Reveal instructions --> 
-    <script type="text/javascript" src="${g.site_url}/scripts/reveal_instructions.js"></script> 
-    <link rel="stylesheet" href="${g.site_url}/css/reveal_instructions.css" /> 
-
     <!-- Auto-generate 'name' field --><script type="text/javascript">
       jQuery(document).ready(function($) {


--- a/ckan/templates/package/new_package_form.html	Tue Sep 13 10:30:39 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 13 10:43:58 2011 +0100
@@ -16,15 +16,18 @@
 <fieldset id="basic-information"><dl><dt class="title-label"><label class="field_opt" for="title">Title</label></dt>
-    <dd class="title-field"><input id="title" tabindex="1" name="title" type="text" value="${data.get('title', '')}"/></dd>
-    <dd class="title-instructions instructions basic">A short descriptive title for the dataset.</dd>
-    <dd class="title-instructions instructions further">It should not be a description though - save that for the Notes field. Do not give a trailing full stop.</dd>
+    <dd class="title-field">
+      <input id="title"
+        tabindex="1" name="title" type="text"
+        value="${data.get('title', '')}"
+        placeholder="A short descriptive title for the dataset"
+      />
+    </dd><dd class="title-instructions field_error" py:if="errors.get('title', '')">${errors.get('title', '')}</dd><dt class="name-label"><label class="field_req" for="name">Slug *</label></dt><dd class="name-field"><input id="name" tabindex="999" maxlength="100" name="name" type="text" value="${data.get('name', '')}" /></dd>
-    <dd class="name-instructions instructions basic">A unique identifier for the dataset.</dd>
-    <dd class="name-instructions instructions further">It should be broadly humanly readable, in the spirit of Semantic Web URIs. Only use an acronym if it is widely recognised. Renaming is possible but discouraged.</dd>
+    <dd class="name-instructions instructions basic">A unique identifier used in urls. Renaming is possible but discouraged.</dd><dd class="name-instructions hints">2+ characters, lowercase, using only 'a-z0-9' and '-_'</dd><dd class="name-instructions field_error" py:if="errors.get('name', '')">${errors.get('name', '')}</dd>
 


http://bitbucket.org/okfn/ckan/changeset/a822bd4031b6/
changeset:   a822bd4031b6
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 12:01:56
summary:     [tests/package][xs]: micro fix to correct breaking over-sensitive tests for form errors (was checking for exact css class!).
affected #:  1 file (8 bytes)

--- a/ckan/tests/functional/test_package.py	Tue Sep 13 10:43:58 2011 +0100
+++ b/ckan/tests/functional/test_package.py	Tue Sep 13 11:01:56 2011 +0100
@@ -59,7 +59,7 @@
     
     def _assert_form_errors(self, res):
         self.check_tag(res, '<form', 'class="has-errors"')
-        assert 'class="field_error"' in res, res
+        assert 'field_error' in res, res
 
     def diff_responses(self, res1, res2):
         return self.diff_html(res1.body, res2.body)


http://bitbucket.org/okfn/ckan/changeset/2f7ffc40c8eb/
changeset:   2f7ffc40c8eb
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-13 12:08:06
summary:     Flexitable removed.
affected #:  2 files (0 bytes)

--- a/ckan/public/css/flexitable.css	Mon Sep 12 17:48:56 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-table.flexitable .controls {
-	padding: 0;
-	width: 4em;
-}
-
-table.flexitable input[type="url"] {
-  width: auto;
-}
-
-form .resource-hash, form .resource-id {
-  display: none;
-}
-
-table.flexitable .controls a {
-	float: left;
-	display: block;
-	height: 16px;
-	width: 16px;
-	margin: 0 0.3em 0 0;
-	padding: 0;
-	background-color: transparent;
-	background-repeat: no-repeat;
-	background-position: left top;
-	overflow: hidden;
-	text-indent: -999em;
-	letter-spacing: -1000em;
-}
-
-table.flexitable .controls a:last-child {
-	margin-right: 0;
-}
-
-table.flexitable .controls a.remove { background-image: url(../images/icons/remove.png); }
-/*.flexitable .controls .move { 
-	background-image: url(../images/icons/handle_grey.png);
-	cursor: move;
-}*/
-table.flexitable .controls a.moveUp { background-image: url(../images/icons/arrow_up.png); }
-table.flexitable .controls a.moveDown { background-image: url(../images/icons/arrow_down.png); }
-
-p.flexitable button.addRow {
-	background-image: url(../images/icons/add.png);
-	background-position: 0.4em 0.4em;
-	background-repeat: no-repeat;
-	padding-left: 1.7em;
-}
-
-button.addRow {
-        float: right;
-}


--- a/ckan/public/scripts/flexitable.js	Mon Sep 12 17:48:56 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/* flexitable.js
-  
-   TODO:
-   - replace separate moveUp/moveDown buttons with a drag handle.
-*/
-
-(function ($) {
-
-  var fieldNameRegex = /^(\S+)__(\d+)__(\S+)$/;
-
-  var controlsHtml = '<td><div class="controls">' +
-                       '<a class="moveUp"   title="Move this row up" href="#moveUp">Move up</a>' +
-                       '<a class="moveDown" title="Move this row down" href="#moveDown">Move down</a>' +
-                       '<a class="remove"   title="Remove this row" href="#remove">Remove row</a>' +
-                     '</div></td>';
-  
-  var addRowHtml = '<p class="flexitable"><button class="addRow">' + MSG_ADD_ROW + '</button></p>';
-
-  function getRowNumber(tr) {
-    var rowNumber = $(tr).find('input').attr('name').match(fieldNameRegex)[2];
-    return parseInt(rowNumber, 10);
-  }
-
-  function setRowNumber(tr, num) {
-    $(tr).find('input').each(function () {
-      $(this).attr({
-        id:   $(this).attr('id').replace(fieldNameRegex, "$1__" + num + "__$3"),
-        name: $(this).attr('name').replace(fieldNameRegex, "$1__" + num + "__$3")
-      });
-    });
-  }
-  
-  // Currently only supports -1 or 1 for up or down respectively.
-  function moveRow(row, offset) {
-    row = $(row);
-    var movingUp = (offset < 0),
-        swapWith = movingUp ? 'prev' : 'next',
-        swapHow  = movingUp ? 'after' : 'before',
-        swapEl = row[swapWith](),
-        rowNum = getRowNumber(row);
-
-    if (swapEl[0]) {
-      row[swapHow](swapEl);
-
-      setRowNumber(row, rowNum + offset);
-      setRowNumber(swapEl, rowNum);
-    }
-  }
-  
-  function addRow (e) {
-    e.preventDefault();
-    var table = $(this).parents('p').eq(0).prev(),
-        lastRow = table.find('tr:last'),
-        clone = lastRow.clone(true);
-
-    clone.insertAfter(lastRow).find('input').val('');
-    setRowNumber(clone, getRowNumber(lastRow) + 1);
-    return false;
-  }
-  
-  function removeRow () {
-    if (confirm('Are you sure you wish to remove this row?')) {
-      var row = $(this).parents('tr'),
-          following = row.nextAll();
-          prev = row.prevAll();
-
-      if (following.length + prev.length  == 0) {
-          row.find('input').val('')
-          return
-      }
-      row.remove();
-      following.each(function () {
-        setRowNumber(this, getRowNumber(this) - 1);
-      });
-    }
-    return false;
-  }
-
-  $(document).ready(function () {
-    $('.flexitable').find('tbody tr').append(controlsHtml).end()
-
-                    .find('a.moveUp').click(function () {
-                      moveRow($(this).parents('tr')[0], -1);
-                      return false;
-                    }).end()
-
-                    .find('a.moveDown').click(function () {
-                      moveRow($(this).parents('tr')[0], 1);
-                      return false;
-                    }).end()
-                    
-                    .find('a.remove').click(removeRow).end()
-                    
-                    .after(addRowHtml)
-                    .next().find('button.addRow').click(addRow);
-  });
-
-})(jQuery);


http://bitbucket.org/okfn/ckan/changeset/3e7b2d2fe247/
changeset:   3e7b2d2fe247
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-13 12:09:13
summary:     [merge,single commit]: Pulling from repo
affected #:  8 files (2.0 KB)

--- a/ckan/public/css/reveal_instructions.css	Tue Sep 13 11:08:06 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-fieldset span.as_hyperlink {
-  text-decoration: underline;
-  color: blue;
-  cursor: pointer; }
-


--- a/ckan/public/scripts/reveal_instructions.js	Tue Sep 13 11:08:06 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-(function ($) {
-  $(document).ready(function () {
-    $('fieldset .basic').each(function() {
-        var basic = $(this);
-        var further = basic.next('.further');
-        if (further.length) {
-            var more = $('<span class="more"> <span class="as_hyperlink">' + MSG_MORE_HELP + '</span></span>');
-            basic.append(more);
-            further.hide();
-            more.click(function(){
-                further.slideDown('fast');
-                $(this).hide()
-            });
-        };
-    });
-  })
-})(jQuery);


--- a/ckan/templates/layout_base.html	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/templates/layout_base.html	Tue Sep 13 11:09:13 2011 +0100
@@ -38,40 +38,6 @@
   <![endif]--><link rel="stylesheet" href="${g.site_url}/css/style.css?v=2" /><link rel="stylesheet" href="${g.site_url}/css/forms.css" type="text/css" media="screen, print" />
-  
-  <script type="text/javascript" src="${g.site_url}/language.js"></script>
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
-  <!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.6.2/jquery.js'>\x3C/script>")]]></script-->
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.tmpl/beta1/jquery.tmpl.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.cookie/jquery.cookie.min.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.placeholder/jquery.placeholder.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jqueryui/1.8.11/jquery-ui.min.js"></script>
-  <!-- for ckanjs etc -->
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/underscore/1.1.6/underscore.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/backbone/0.5.1/backbone.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/showdown/showdown.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.iframe-transport.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.fileupload.js"></script>
-  <script src="https://raw.github.com/okfn/ckanjs/master/pkg/ckanjs.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/ckanjs.js"></script>
-  <!-- finally our application js that sets everything up-->
-  <script type="text/javascript" src="${g.site_url}/scripts/application.js?lang=${c.locale}"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/templates.js"></script>
-
-
-  <script src="${g.site_url}/scripts/vendor/modernizr/1.7/modernizr.min.js"></script>
-
-  <script type="text/javascript">
-    $(document).ready(function() {
-        var ckan_user = $.cookie("ckan_display_name");
-        if (ckan_user) {
-            $(".ckan-logged-out").hide();
-            $(".ckan-logged-in").show();
-        }
-        $('input[placeholder], textarea[placeholder]').placeholder();
-    });
-  </script><py:if test="defined('optional_head')">
     ${optional_head()}
@@ -235,6 +201,38 @@
     </footer></div><!-- eo #container -->
 
+  <script type="text/javascript" src="${g.site_url}/language.js"></script>
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+  <!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.6.2/jquery.js'>\x3C/script>")]]></script-->
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.tmpl/beta1/jquery.tmpl.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.cookie/jquery.cookie.min.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.placeholder/jquery.placeholder.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jqueryui/1.8.11/jquery-ui.min.js"></script>
+  <!-- for ckanjs etc -->
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/underscore/1.1.6/underscore.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/backbone/0.5.1/backbone.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/showdown/showdown.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.iframe-transport.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.fileupload.js"></script>
+  <script src="https://raw.github.com/okfn/ckanjs/master/pkg/ckanjs.js"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/ckanjs.js"></script>
+  <!-- finally our application js that sets everything up-->
+  <script type="text/javascript" src="${g.site_url}/scripts/application.js?lang=${c.locale}"></script>
+  <script type="text/javascript" src="${g.site_url}/scripts/templates.js"></script>
+
+  <script src="${g.site_url}/scripts/vendor/modernizr/1.7/modernizr.min.js"></script>
+
+  <script type="text/javascript">
+    $(document).ready(function() {
+        var ckan_user = $.cookie("ckan_display_name");
+        if (ckan_user) {
+            $(".ckan-logged-out").hide();
+            $(".ckan-logged-in").show();
+        }
+        $('input[placeholder], textarea[placeholder]').placeholder();
+    });
+  </script><py:if test="defined('optional_footer')">
     ${optional_footer()}


--- a/ckan/templates/package/new.html	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/templates/package/new.html	Tue Sep 13 11:09:13 2011 +0100
@@ -8,11 +8,7 @@
 
   <py:def function="body_class">hide-sidebar</py:def>
 
-  <py:def function="optional_head">
-    <!-- Reveal instructions --> 
-    <script type="text/javascript" src="${g.site_url}/scripts/reveal_instructions.js"></script> 
-    <link rel="stylesheet" href="${g.site_url}/css/reveal_instructions.css" /> 
-
+  <py:def function="optional_footer"><!-- Auto-generate 'name' field --><script type="text/javascript">
       jQuery(document).ready(function($) {


--- a/ckan/templates/package/new_package_form.html	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 13 11:09:13 2011 +0100
@@ -16,15 +16,18 @@
 <fieldset id="basic-information"><dl><dt class="title-label"><label class="field_opt" for="title">Title</label></dt>
-    <dd class="title-field"><input id="title" tabindex="1" name="title" type="text" value="${data.get('title', '')}"/></dd>
-    <dd class="title-instructions instructions basic">A short descriptive title for the dataset.</dd>
-    <dd class="title-instructions instructions further">It should not be a description though - save that for the Notes field. Do not give a trailing full stop.</dd>
+    <dd class="title-field">
+      <input id="title"
+        tabindex="1" name="title" type="text"
+        value="${data.get('title', '')}"
+        placeholder="A short descriptive title for the dataset"
+      />
+    </dd><dd class="title-instructions field_error" py:if="errors.get('title', '')">${errors.get('title', '')}</dd><dt class="name-label"><label class="field_req" for="name">Slug *</label></dt><dd class="name-field"><input id="name" tabindex="999" maxlength="100" name="name" type="text" value="${data.get('name', '')}" /></dd>
-    <dd class="name-instructions instructions basic">A unique identifier for the dataset.</dd>
-    <dd class="name-instructions instructions further">It should be broadly humanly readable, in the spirit of Semantic Web URIs. Only use an acronym if it is widely recognised. Renaming is possible but discouraged.</dd>
+    <dd class="name-instructions instructions basic">A unique identifier used in urls. Renaming is possible but discouraged.</dd><dd class="name-instructions hints">2+ characters, lowercase, using only 'a-z0-9' and '-_'</dd><dd class="name-instructions field_error" py:if="errors.get('name', '')">${errors.get('name', '')}</dd>
 
@@ -139,13 +142,6 @@
     </ul><div class="resource-add-form"></div></div>
-
-  <!--
-  <div class="instructions basic">The files containing the data or address of the APIs for accessing it.</div>
-  <div class="instructions further"><br />These can be repeated as required. For example if the data is being supplied in multiple formats, or split into different areas or time periods, each file is a different 'resource' which should be described differently. They will all appear on the dataset page on CKAN together.<br /><br /><b>URL:</b> This is the Internet link directly to the data - by selecting this link in a web browser, the user will immediately download the full dataset. Note that datasets are not hosted on this site, but by the publisher of the data. Alternatively the URL can point to an API server such as a SPARQL endpoint or JSON-P service.<br /><b>Format:</b> This should give the file format in which the data is supplied. <br /><b>Description</b> Any information you want to add to describe the resource.<br /></div>
-  <div class="hints">Format choices: CSV | RDF | XML | XBRL | SDMX | HTML+RDFa | Other as appropriate</div>
-  <div class="field_error" py:if="errors.get('resources', '')">Dataset resource(s) incomplete.</div>
-  --></fieldset><fieldset id="groups">


--- a/ckan/templates/user/login.html	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/templates/user/login.html	Tue Sep 13 11:09:13 2011 +0100
@@ -6,6 +6,8 @@
   <py:def function="optional_head"><!-- Simple OpenID Selector --><link rel="stylesheet" href="${g.site_url}/scripts/vendor/openid-selector/css/openid.css" />
+  </py:def>
+  <py:def function="optional_footer"><script type="text/javascript" src="${g.site_url}/scripts/vendor/openid-selector/js/openid-jquery.js"></script><script type="text/javascript">
       $(document).ready(function() {


--- a/ckan/tests/functional/test_authz.py	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/tests/functional/test_authz.py	Tue Sep 13 11:09:13 2011 +0100
@@ -98,10 +98,15 @@
                 offset = '/%s/list' % entity
         elif action == 'create':
             offset = '/%s/new' % entity
-            str_required_in_response = 'New'
+            if entity == 'dataset':
+                str_required_in_response = 'Add'
+            else:
+                str_required_in_response = 'New'
         elif action == 'delete':
             offset = url_for(controller=controller_name, action=model.Action.EDIT, id=unicode(entity_name))
-            str_required_in_response = 'state'
+            # this is ludicrously sensitive (we have to improve html testing!)
+            # str_required_in_response = 'state'
+            str_required_in_response = '<select id="state"'
         else:
             raise NotImplementedError
         res = self.app.get(offset, extra_environ={'REMOTE_USER': user.name.encode('utf8')}, expect_errors=True)
@@ -110,6 +115,8 @@
         tests['error string'] = bool('error' not in res)
         tests['status'] = bool(res.status in (200, 201))
         tests['0 packages found'] = bool(u'0 packages found' not in res)
+        print tests
+        print res
         is_ok = False not in tests.values()
         # clear flash messages - these might make the next page request
         # look like it has an error
@@ -376,7 +383,7 @@
         assert not model.Package.by_name(u'annakarenina')
         offset = url_for(controller='package', action='new')
         res = self.app.get(offset, extra_environ={'REMOTE_USER': user.name.encode('utf8')})
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         prefix = ''
         fv[prefix + 'name'] = u'annakarenina'


--- a/ckan/tests/functional/test_package.py	Tue Sep 13 11:08:06 2011 +0100
+++ b/ckan/tests/functional/test_package.py	Tue Sep 13 11:09:13 2011 +0100
@@ -59,7 +59,7 @@
     
     def _assert_form_errors(self, res):
         self.check_tag(res, '<form', 'class="has-errors"')
-        assert 'class="field_error"' in res, res
+        assert 'field_error' in res, res
 
     def diff_responses(self, res1, res2):
         return self.diff_html(res1.body, res2.body)


http://bitbucket.org/okfn/ckan/changeset/1419b1c96ca5/
changeset:   1419b1c96ca5
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 12:15:03
summary:     [theme][xs]: (refs #1108) re-add ckan version number in powered by section at bottom of the page.
affected #:  1 file (18 bytes)

--- a/ckan/templates/layout_base.html	Tue Sep 13 11:09:13 2011 +0100
+++ b/ckan/templates/layout_base.html	Tue Sep 13 11:15:03 2011 +0100
@@ -195,7 +195,7 @@
         <a href="http://opendefinition.org/"><img alt="This Content and Data is Open" src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" style="border: none ; margin-bottom: -4px;"/></a><br/><br/>
-        Powered by <a href="http://ckan.org">CKAN</a>.<br/>
+        Powered by <a href="http://ckan.org">CKAN</a> v${c.__version__}.<br/></p></div></footer>


http://bitbucket.org/okfn/ckan/changeset/1a57c1c0c8b8/
changeset:   1a57c1c0c8b8
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 12:47:19
summary:     [language.js][s]: remove language.js and usage in code as 2 strings therein are no longer used.

* NB: we will need to do js i18n going forward but will probably do it in some different way (?).
affected #:  4 files (361 bytes)

--- a/ckan/config/routing.py	Tue Sep 13 11:15:03 2011 +0100
+++ b/ckan/config/routing.py	Tue Sep 13 11:47:19 2011 +0100
@@ -31,7 +31,6 @@
     map.connect('home', '/', controller='home', action='index')
     map.connect('guide', config.get('guide_url', 'http://wiki.okfn.org/ckan/doc/'), _static=True)
     map.connect('license', '/license', controller='home', action='license')
-    map.connect('/language.js', controller='home', action='language')
     map.connect('/locale', controller='home', action='locale')
     map.connect('about', '/about', controller='home', action='about')
 


--- a/ckan/controllers/home.py	Tue Sep 13 11:15:03 2011 +0100
+++ b/ckan/controllers/home.py	Tue Sep 13 11:47:19 2011 +0100
@@ -75,11 +75,6 @@
     def about(self):
         return render('home/about.html', cache_expire=cache_expires)
         
-    def language(self):
-        response.content_type = 'text/javascript'
-        return render('home/language.js', cache_expire=cache_expires,
-                      method='text', loader_class=NewTextTemplate)
-    
     def locale(self): 
         locale = request.params.get('locale')
         if locale is not None:


--- a/ckan/templates/home/language.js	Tue Sep 13 11:15:03 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-var MSG_MORE_HELP = '${_("More »")}';
-var MSG_ADD_ROW = '${_("Add row to table")}';
\ No newline at end of file


--- a/ckan/templates/layout_base.html	Tue Sep 13 11:15:03 2011 +0100
+++ b/ckan/templates/layout_base.html	Tue Sep 13 11:47:19 2011 +0100
@@ -201,7 +201,6 @@
     </footer></div><!-- eo #container -->
 
-  <script type="text/javascript" src="${g.site_url}/language.js"></script><script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.6.2/jquery.js'>\x3C/script>")]]></script--><script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script>


http://bitbucket.org/okfn/ckan/changeset/0650b9128157/
changeset:   0650b9128157
branch:      feature-1324-add-fields-to-resource
user:        rgrp
date:        2011-09-13 12:48:16
summary:     [close-branch][s]: close branch prior to merge into feature-1294-ux-improvements-dataset.
affected #:  0 files (0 bytes)

http://bitbucket.org/okfn/ckan/changeset/e53d20f996dc/
changeset:   e53d20f996dc
branch:      feature-1294-ux-improvements-dataset
user:        rgrp
date:        2011-09-13 12:49:12
summary:     [merge,from-branch][m]: merge from kindly's completed feature-1324-add-fields-to-resource.
affected #:  14 files (5.6 KB)

--- a/ckan/forms/common.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/forms/common.py	Tue Sep 13 11:49:12 2011 +0100
@@ -417,13 +417,19 @@
             # 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']:
-                    value = params.get('%s-%i-%s' % (self.name, row, col), u'')
+                    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


--- a/ckan/lib/create_test_data.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/lib/create_test_data.py	Tue Sep 13 11:49:12 2011 +0100
@@ -320,7 +320,7 @@
             format=u'plain text',
             description=u'Full text. Needs escaping: " Umlaut: \xfc',
             hash=u'abc123',
-            extras={'size': u'123'},
+            extras={'size_extra': u'123'},
             **configured_extras[0]
             )
         pr2 = model.Resource(
@@ -328,7 +328,7 @@
             format=u'json',
             description=u'Index of the novel',
             hash=u'def456',
-            extras={'size': u'345'},
+            extras={'size_extra': u'345'},
             **configured_extras[1]
             )
         model.Session.add(pr1)


--- a/ckan/lib/search/sql.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/lib/search/sql.py	Tue Sep 13 11:49:12 2011 +0100
@@ -94,6 +94,10 @@
                 model_attr = getattr(model.Resource, field)
                 if field == 'hash':                
                     q = q.filter(model_attr.ilike(unicode(term) + '%'))
+                ##not text fields
+                elif field in ('size', 'last_modified', 
+                               'cache_last_updated', 'webstore_last_updated'):
+                    q = q.filter(model_attr == term)
                 elif field in model.Resource.get_extra_columns():
                     model_attr = getattr(model.Resource, 'extras')
 


--- a/ckan/logic/schema.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/logic/schema.py	Tue Sep 13 11:49:12 2011 +0100
@@ -26,6 +26,7 @@
                                    user_both_passwords_entered,
                                    user_passwords_match,
                                    user_password_not_empty,
+                                   isodate,
                                    user_about_validator)
 from formencode.validators import OneOf
 import ckan.model
@@ -45,6 +46,16 @@
         'state': [ignore],
         'position': [ignore],
         'revision_timestamp': [ignore],
+        'name': [ignore_missing, unicode],
+        'resource_type': [ignore_missing, unicode],
+        'mimetype': [ignore_missing, unicode],
+        'mimetype_inner': [ignore_missing, unicode],
+        'webstore_url': [ignore_missing, unicode],
+        'cache_url': [ignore_missing, unicode],
+        'size': [ignore_missing, int],
+        'last_modified': [ignore_missing, isodate],
+        'cache_last_updated': [ignore_missing, isodate],
+        'webstore_last_updated': [ignore_missing, isodate],
         '__extras': [ignore_missing, extras_unicode_convert, keep_extras],
     }
 


--- a/ckan/logic/validators.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/logic/validators.py	Tue Sep 13 11:49:12 2011 +0100
@@ -1,8 +1,10 @@
 import re
+import datetime
 from pylons.i18n import _, ungettext, N_, gettext
 from ckan.lib.navl.dictization_functions import Invalid, Missing, missing, unflatten
 from ckan.authz import Authorizer
 from ckan.logic import check_access, NotAuthorized
+from ckan.lib.helpers import date_str_to_datetime
 
 
 def package_id_not_changed(value, context):
@@ -13,6 +15,17 @@
                         'This key is read-only') % (package.id, value))
     return value
 
+def isodate(value, context):
+
+    if isinstance(value, datetime.datetime):
+        return value
+    try:
+        date = date_str_to_datetime(value)
+        context['revision_date'] = date
+    except (TypeError, ValueError), e:
+        raise Invalid(_('Date format incorrect'))
+    return date
+
 def no_http(value, context):
 
     model = context['model']


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckan/migration/versions/041_resource_new_fields.py	Tue Sep 13 11:49:12 2011 +0100
@@ -0,0 +1,32 @@
+from migrate import *
+
+def upgrade(migrate_engine):
+    migrate_engine.execute(
+    '''
+    begin;
+    ALTER TABLE resource
+    ADD COLUMN name text,
+    ADD COLUMN resource_type text,
+    ADD COLUMN mimetype text,
+    ADD COLUMN mimetype_inner text,
+    ADD COLUMN "size" bigint,
+    ADD COLUMN last_modified timestamp without time zone,
+    ADD COLUMN cache_url text,
+    ADD COLUMN cache_last_updated timestamp without time zone,
+    ADD COLUMN webstore_url text,
+    ADD COLUMN webstore_last_updated timestamp without time zone;
+
+    ALTER TABLE resource_revision
+    ADD COLUMN name text,
+    ADD COLUMN resource_type text,
+    ADD COLUMN mimetype text,
+    ADD COLUMN mimetype_inner text,
+    ADD COLUMN "size" bigint,
+    ADD COLUMN last_modified timestamp without time zone,
+    ADD COLUMN cache_url text,
+    ADD COLUMN cache_last_updated timestamp without time zone,
+    ADD COLUMN webstore_url text,
+    ADD COLUMN webstore_last_updated timestamp without time zone;
+    commit;
+    '''
+    )


--- a/ckan/model/resource.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/model/resource.py	Tue Sep 13 11:49:12 2011 +0100
@@ -16,6 +16,13 @@
            'ResourceGroupRevision', 'resource_group_revision_table',
            ]
 
+CORE_RESOURCE_COLUMNS = ['url', 'format', 'description', 'hash', 'name',
+                         'resource_type', 'mimetype', 'mimetype_inner',
+                         'size', 'last_modified', 'cache_url', 'cache_last_updated',
+                         'webstore_url', 'webstore_last_updated']
+
+
+
 ##formally package_resource
 resource_table = Table(
     'resource', metadata,
@@ -26,6 +33,18 @@
     Column('description', types.UnicodeText),
     Column('hash', types.UnicodeText),
     Column('position', types.Integer),
+
+    Column('name', types.UnicodeText),
+    Column('resource_type', types.UnicodeText),
+    Column('mimetype', types.UnicodeText),
+    Column('mimetype_inner', types.UnicodeText),
+    Column('size', types.BigInteger),
+    Column('last_modified', types.DateTime),
+    Column('cache_url', types.UnicodeText),
+    Column('cache_last_updated', types.DateTime),
+    Column('webstore_url', types.UnicodeText),
+    Column('webstore_last_updated', types.DateTime),
+    
     Column('extras', JsonDictType),
     )
 
@@ -59,8 +78,12 @@
         self.format = format
         self.description = description
         self.hash = hash
+        # The base columns historically defaulted to empty strings
+        # not None (Null). This is why they are seperate here.
+        base_columns = ['url', 'format', 'description', 'hash']
+        for key in set(CORE_RESOURCE_COLUMNS) - set(base_columns):
+            setattr(self, key, kwargs.pop(key, None))
         self.extras = extras or {}
-
         extra_columns = self.get_extra_columns()
         for field in extra_columns:
             value = kwargs.pop(field, None)
@@ -95,9 +118,9 @@
     def get_columns(cls, extra_columns=True):
         '''Returns the core editable columns of the resource.'''
         if extra_columns:
-            return ['url', 'format', 'description', 'hash'] + cls.get_extra_columns()
+            return CORE_RESOURCE_COLUMNS + cls.get_extra_columns()
         else:
-            return ['url', 'format', 'description', 'hash']
+            return CORE_RESOURCE_COLUMNS
 
     @classmethod
     def get_extra_columns(cls):


--- a/ckan/tests/forms/test_package.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/forms/test_package.py	Tue Sep 13 11:49:12 2011 +0100
@@ -95,7 +95,7 @@
             assert u'Full text. Needs escaping: " Umlaut: \xfc"' in out, out_printable        
             assert res.hash in out, out_printable        
             assert res.alt_url in out, out_printable        
-            assert res.extras['size'] in out, out_printable        
+            assert res.extras['size_extra'] in out, out_printable        
 
     def test_2_fields(self):
         fs = self._get_standard_fieldset()
@@ -131,6 +131,7 @@
         indict['Package--resources-0-url'] = u'http:/1'
         indict['Package--resources-0-format'] = u'xml'
         indict['Package--resources-0-description'] = u'test desc'
+        indict['Package--resources-0-size'] = 10
         indict['Package--resources-0-alt_url'] = u'http:/2'
 
         fs = self._get_standard_fieldset().bind(model.Package, data=indict)


--- a/ckan/tests/functional/api/base.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/functional/api/base.py	Tue Sep 13 11:49:12 2011 +0100
@@ -317,14 +317,14 @@
             u'description':u'Main file',
             u'hash':u'abc123',
             u'alt_url':u'alt_url',
-            u'size':u'200',
+            u'size_extra':u'200',
         }, {
             u'url':u'http://blah.com/file2.xml',
             u'format':u'xml',
             u'description':u'Second file',
             u'hash':u'def123',
             u'alt_url':u'alt_url',
-            u'size':u'200',
+            u'size_extra':u'200',
         }],
         'tags': [u'russion', u'novel'],
         'license_id': testpackage_license_id,


--- a/ckan/tests/functional/api/model/test_package.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/functional/api/model/test_package.py	Tue Sep 13 11:49:12 2011 +0100
@@ -262,14 +262,14 @@
                 u'description':u'Appendix 1',
                 u'hash':u'def123',
                 u'alt_url':u'alt123',
-                u'size':u'400',
+                u'size_extra':u'400',
             },{
                 u'url':u'http://blah.com/file3.xml',
                 u'format':u'xml',
                 u'description':u'Appenddic 2',
                 u'hash':u'ghi123',
                 u'alt_url':u'alt123',
-                u'size':u'400',
+                u'size_extra':u'400',
             }],
             'extras': {
                 u'key3': u'val3', 
@@ -321,14 +321,14 @@
         self.assert_equal(resource.description, u'Appendix 1')
         self.assert_equal(resource.hash, u'def123')
         self.assert_equal(resource.alt_url, u'alt123')
-        self.assert_equal(resource.extras['size'], u'400')
+        self.assert_equal(resource.extras['size_extra'], u'400')
         resource = package.resources[1]
         self.assert_equal(resource.url, 'http://blah.com/file3.xml')
         self.assert_equal(resource.format, u'xml')
         self.assert_equal(resource.description, u'Appenddic 2')
         self.assert_equal(resource.hash, u'ghi123')
         self.assert_equal(resource.alt_url, u'alt123')
-        self.assert_equal(resource.extras['size'], u'400')
+        self.assert_equal(resource.extras['size_extra'], u'400')
 
         # Check unsubmitted fields have not changed.
         # - url


--- a/ckan/tests/functional/test_package.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/functional/test_package.py	Tue Sep 13 11:49:12 2011 +0100
@@ -148,6 +148,9 @@
         self.check_tag(main_res, prefix+'version', params['version'])
         self.check_tag(main_res, prefix+'url', params['url'])
         for res_index, res_field, expected_value in self._get_resource_values(params['resources']):
+            ### only check fields that are on the form 
+            if res_field not in ['url', 'id', 'description', 'hash']:
+                continue
             self.check_tag(main_res, '%sresources__%i__%s' % (prefix, res_index, res_field), expected_value)
         self.check_tag_and_data(main_res, prefix+'notes', params['notes'])
         self.check_tag_and_data(main_res, 'selected', params['license_id'])
@@ -789,7 +792,7 @@
             resources = ((u'http://something.com/somewhere-else.xml', u'xml', u'Best', u'hash1', 'alt'),
                          (u'http://something.com/somewhere-else2.xml', u'xml2', u'Best2', u'hash2', 'alt'),
                          )
-            assert len(resources[0]) == len(model.Resource.get_columns())
+            assert len(resources[0]) == 5
             notes = u'Very important'
             license_id = u'gpl-3.0'
             state = model.State.ACTIVE


--- a/ckan/tests/lib/test_dictization.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/lib/test_dictization.py	Tue Sep 13 11:49:12 2011 +0100
@@ -49,25 +49,45 @@
             'notes': u'Some test notes\n\n### A 3rd level heading\n\n**Some bolded text.**\n\n*Some italicized text.*\n\nForeign characters:\nu with umlaut \xfc\n66-style quote \u201c\nforeign word: th\xfcmb\n \nNeeds escaping:\nleft arrow <\n\n<http://ckan.net/>\n\n',
             'relationships_as_object': [],
             'relationships_as_subject': [],
-            'resources': [{'alt_url': u'alt123',
-                           'description': u'Full text. Needs escaping: " Umlaut: \xfc',
-                           'size': u'123',
-                           'format': u'plain text',
-                           'hash': u'abc123',
-                           'position': 0,
-                           'state': u'active',
-                           'url': u'http://www.annakarenina.com/download/x=1&y=2'},
-                          {'alt_url': u'alt345',
-                           'description': u'Index of the novel',
-                           'size': u'345',
-                           'format': u'json',
-                           'hash': u'def456',
-                           'position': 1,
-                           'state': u'active',
-                           'url': u'http://www.annakarenina.com/index.json'}],
+            'resources': [{u'alt_url': u'alt123',
+                            u'cache_last_updated': None,
+                            u'cache_url': None,
+                            u'description': u'Full text. Needs escaping: " Umlaut: \xfc',
+                            u'format': u'plain text',
+                            u'hash': u'abc123',
+                            u'last_modified': None,
+                            u'mimetype': None,
+                            u'mimetype_inner': None,
+                            u'name': None,
+                            u'position': 0,
+                            u'resource_type': None,
+                            u'size': None,
+                            u'size_extra': u'123',
+                            u'state': u'active',
+                            u'url': u'http://www.annakarenina.com/download/x=1&y=2',
+                            u'webstore_last_updated': None,
+                            u'webstore_url': None},
+                           {u'alt_url': u'alt345',
+                            u'cache_last_updated': None,
+                            u'cache_url': None,
+                            u'description': u'Index of the novel',
+                            u'format': u'json',
+                            u'hash': u'def456',
+                            u'last_modified': None,
+                            u'mimetype': None,
+                            u'mimetype_inner': None,
+                            u'name': None,
+                            u'position': 1,
+                            u'resource_type': None,
+                            u'size': None,
+                            u'size_extra': u'345',
+                            u'state': u'active',
+                            u'url': u'http://www.annakarenina.com/index.json',
+                            u'webstore_last_updated': None,
+                            u'webstore_url': None}],
             'state': u'active',
-                        'tags': [{'name': u'russian', 'state': u'active'},
-                                 {'name': u'tolstoy', 'state': u'active'}],
+            'tags': [{'name': u'russian', 'state': u'active'},
+                     {'name': u'tolstoy', 'state': u'active'}],
             'title': u'A Novel By Tolstoy',
             'url': u'http://www.annakarenina.com',
             'version': u'0.7a'}
@@ -139,14 +159,25 @@
 
 
         assert result == {
-             'alt_url': u'alt123',
+            u'alt_url': u'alt123',
+             'cache_last_updated': None,
+             'cache_url': None,
              'description': u'Full text. Needs escaping: " Umlaut: \xfc',
              'format': u'plain text',
              'hash': u'abc123',
+             'last_modified': None,
+             'mimetype': None,
+             'mimetype_inner': None,
+             'name': None,
              'position': 0,
-             'size': u'123',
+             'resource_type': None,
+             'size': None,
+             u'size_extra': u'123',
              'state': u'active',
-             'url': u'http://www.annakarenina.com/download/x=1&y=2'}, pprint(result)
+             'url': u'http://www.annakarenina.com/download/x=1&y=2',
+             'webstore_last_updated': None,
+             'webstore_url': None
+            }, pprint(result)
 
         ## package extra
 
@@ -629,12 +660,23 @@
         forth_dictized = self.remove_changable_columns(package_dictize(anna1, context))
 
         third_dictized['notes'] = 'wee'
-        third_dictized['resources'].insert(2, {u'description': u'',
-                                            u'format': u'plain text',
-                                            u'hash': u'',
-                                            u'position': 2,
-                                            u'state': u'active',
-                                            u'url': u'newurl'})
+        third_dictized['resources'].insert(2, {
+            u'cache_last_updated': None,
+            u'cache_url': None,
+            u'description': u'',
+            u'format': u'plain text',
+            u'hash': u'',
+            u'last_modified': None,
+            u'mimetype': None,
+            u'mimetype_inner': None,
+            u'name': None,
+            u'position': 2,
+            u'resource_type': None,
+            u'size': None,
+            u'state': u'active',
+            u'url': u'newurl',
+            u'webstore_last_updated': None,
+            u'webstore_url': None})
 
         third_dictized['tags'].insert(1, {'name': u'newnew_tag', 'state': 'active'})
         third_dictized['extras'].insert(0, {'key': 'david', 
@@ -656,15 +698,23 @@
         model.Session.commit()
 
         new_resource = {
-            'alt_url': u'empty resource group id',
+            'mimetype': None,
+            u'alt_url': u'empty resource group id',
+            'hash': u'abc123',
             'description': u'Full text. Needs escaping: " Umlaut: \xfc',
-            'size': u'123',
             'format': u'plain text',
-            'hash': u'abc123',
+            'url': u'test',
+            'cache_url': None,
+            'webstore_url': None,
+            'cache_last_updated': None,
+            'state': u'active',
+            'mimetype_inner': None,
+            'webstore_last_updated': None,
+            'last_modified': None,
             'position': 0,
-            'state': u'active',
-            'url': u'test'
-        }
+            'size': 123,
+            'resource_type': None,
+            'name': None}
 
         model.repo.new_revision()
         resource_dict_save(new_resource, context)


--- a/ckan/tests/lib/test_dictization_schema.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/lib/test_dictization_schema.py	Tue Sep 13 11:49:12 2011 +0100
@@ -76,13 +76,13 @@
                                                 'description': u'Full text. Needs escaping: " Umlaut: \xfc',
                                                 'format': u'plain text',
                                                 'hash': u'abc123',
-                                                'size': u'123',
+                                                'size_extra': u'123',
                                                 'url': u'http://www.annakarenina.com/download/x=1&y=2'},
                                                {'alt_url': u'alt345',
                                                 'description': u'Index of the novel',
                                                 'format': u'json',
                                                 'hash': u'def456',
-                                                'size': u'345',
+                                                'size_extra': u'345',
                                                 'url': u'http://www.annakarenina.com/index.json'}],
                                  'tags': [{'name': u'russian'}, {'name': u'tolstoy'}],
                                  'title': u'A Novel By Tolstoy',


--- a/ckan/tests/lib/test_resource_search.py	Tue Sep 13 11:47:19 2011 +0100
+++ b/ckan/tests/lib/test_resource_search.py	Tue Sep 13 11:49:12 2011 +0100
@@ -25,14 +25,14 @@
                   'format':'Excel spreadsheet',
                   'hash':'abc-123',
                   'alt_url': 'alt1',
-                  'extras':{'size': '100'},
+                  'extras':{'size_extra': '100'},
                   },
                  {'url':self.cd,
                   'description':'This is site cd.',
                   'format':'Office spreadsheet',
                   'hash':'qwe-456',
                   'alt_url':'alt2',
-                  'extras':{'size':'200'},
+                  'extras':{'size_extra':'200'},
                   },
                  ]             
              },
@@ -122,7 +122,7 @@
         assert isinstance(res_dict, dict)
         res_keys = set(res_dict.keys())
         expected_res_keys = set(model.Resource.get_columns())
-        expected_res_keys.update(['id', 'resource_group_id', 'package_id', 'position', 'size'])
+        expected_res_keys.update(['id', 'resource_group_id', 'package_id', 'position', 'size_extra'])
         assert_equal(res_keys, expected_res_keys)
         pkg1 = model.Package.by_name(u'pkg1')
         ab = pkg1.resources[0]
@@ -183,7 +183,7 @@
 
         # Document that resource extras not in ckan.extra_resource_fields
         # can't be searched
-        fields = {'size':'100'}
+        fields = {'size_extra':'100'}
         assert_raises(SearchError, self.backend.query_for(model.Resource).run, fields=fields)

Repository URL: https://bitbucket.org/okfn/ckan/

--

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