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

Bitbucket commits-noreply at bitbucket.org
Tue Sep 13 21:25:26 UTC 2011


3 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/cc7a6fd8e18f/
changeset:   cc7a6fd8e18f
user:        rgrp
date:        2011-09-13 23:10:57
summary:     [merge,from-branch][s]: merge some recent fixes in feature-1294 branch.
affected #:  3 files (1.0 KB)

--- a/ckan/logic/schema.py	Tue Sep 13 13:19:24 2011 +0100
+++ b/ckan/logic/schema.py	Tue Sep 13 22:10:57 2011 +0100
@@ -31,6 +31,15 @@
 from formencode.validators import OneOf
 import ckan.model
 
+def int_converter(indata):
+    if isinstance(indata, basestring):
+        cleaned = indata.strip()
+        if cleaned != '':
+            return int(indata)
+        else:
+            return None
+    else:
+        return int(indata)
     
 def default_resource_schema():
 
@@ -52,10 +61,10 @@
         '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],
+        'size': [ignore_missing, int_converter],
+        'last_modified': [ignore_empty, isodate],
+        'cache_last_updated': [ignore_empty, isodate],
+        'webstore_last_updated': [ignore_empty, isodate],
         '__extras': [ignore_missing, extras_unicode_convert, keep_extras],
     }
 


--- a/ckan/public/scripts/application.js	Tue Sep 13 13:19:24 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 13 22:10:57 2011 +0100
@@ -369,35 +369,6 @@
 }(jQuery, CKAN.Utils || {});
 
 
-CKAN.View.ResourceAddLink = Backbone.View.extend({
-  initialize: function(options) {
-    _.bindAll(this, 'render');
-    this.mode = options.mode;
-  },
-
-  render: function() {
-    if (this.mode=='file') {
-      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkFile);
-    }
-    else if (this.mode=='api') {
-      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkApi);
-    }
-    $(this.el).html(tmpl);
-    return this;
-  },
-
-  events: {
-    'submit form': 'setResourceInfo',
-  },
-
-  setResourceInfo: function(e) {
-    e.preventDefault();
-    var urlVal=this.el.find('input[name=url]').val();
-    this.model.set({url: urlVal, type: this.mode})
-  }
-});
-
-
 CKAN.View.DatasetEdit = Backbone.View.extend({
   initialize: function() {
     _.bindAll(this, 'render');
@@ -629,3 +600,32 @@
   }
 });
 
+CKAN.View.ResourceAddLink = Backbone.View.extend({
+  initialize: function(options) {
+    _.bindAll(this, 'render');
+    this.mode = options.mode;
+  },
+
+  render: function() {
+    if (this.mode=='file') {
+      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkFile);
+    }
+    else if (this.mode=='api') {
+      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkApi);
+    }
+    $(this.el).html(tmpl);
+    return this;
+  },
+
+  events: {
+    'submit form': 'setResourceInfo',
+  },
+
+  setResourceInfo: function(e) {
+    e.preventDefault();
+    var urlVal=this.el.find('input[name=url]').val();
+    this.model.set({url: urlVal, resource_type: this.mode})
+  }
+});
+
+


--- a/ckan/public/scripts/templates.js	Tue Sep 13 13:19:24 2011 +0100
+++ b/ckan/public/scripts/templates.js	Tue Sep 13 22:10:57 2011 +0100
@@ -88,44 +88,61 @@
   </td> \
   <td class="resource-expanded" colspan="3"> \
     <dl> \
-      <dt><label class="field_opt">Url</label></dt> \
+      <dt>Name</dt> \
       <dd> \
+        <input name="resources__${num}__name" type="text" value="${resource.name}" class="long" /> \
+      </dd> \
+      <dt>Url</dt> \
+      <dd> \
+      {{if resource.resource_type=="file.upload"}} \
+        ${resource.url} \
+        <input name="resources__${num}__url" type="hidden" value="${resource.url}" /> \
+      {{/if}} \
+      {{if resource.resource_type!="file.upload"}} \
         <input name="resources__${num}__url" type="text" value="${resource.url}" class="long" /> \
+      {{/if}} \
       </dd> \
-      <dt>Type</dt> \
+      <dt>Format</dt> \
       <dd> \
-        ${resource.type} \
+        <input name="resources__${num}__format" type="text" value="${resource.format}" class="long" /> \
+      </dd> \
+      <dt>Description</dt> \
+      <dd> \
+        <input name="resources__${num}__description" type="text" value="${resource.description}" class="long" /> \
+      </dd> \
+      <dt>Size (bytes)</dt> \
+      <dd> \
+        <input name="resources__${num}__size" type="text" value="${resource.size}" class="long" /> \
       </dd> \
       <dt>Mimetype</dt> \
       <dd> \
-        ${resource.mimetype} \
+        <input name="resources__${num}__mimetype" type="text" value="${resource.mimetype}" /> \
       </dd> \
       <dt>Mimetype-inner</dt> \
       <dd> \
-        ${resource.mimetype_inner} \
+        <input name="resources__${num}__mimetype_inner" type="text" value="${resource.mimetype_inner}" /> \
       </dd> \
-      <dt>Size</dt> \
+      <dt>Resource Type</dt> \
       <dd> \
-        ${resource.size} \
+        ${resource.resource_type} \
+        <input name="resources__${num}__resource_type" type="hidden" value="${resource.resource_type}" /> \
+      </dd> \
+      <dt>Hash</dt> \
+      <dd> \
+        ${resource.hash || "Unknown"} \
+        <input name="resources__${num}__hash" type="hidden" value="${resource.hash}" /> \
       </dd> \
       <dt>Last Modified</dt> \
       <dd> \
-        ${resource.lastModified} \
+        ${resource.last_modified || "Unknown"} \
+        <input name="resources__${num}__last_modified" type="hidden" value="${resource.last_modified}" /> \
       </dd> \
-      <dt><label class="field_opt">Format</label></dt> \
+      <dt>ID</dt> \
       <dd> \
-        <input name="resources__${num}__format" type="text" value="${resource.format}" class="long" /> \
-      </dd> \
-      <dt><label class="field_opt">Description</label></dt> \
-      <dd> \
-        <input name="resources__${num}__description" type="text" value="${resource.description}" class="long" /> \
-      </dd> \
-      <dt><label class="field_opt">Hash</label></dt> \
-      <dd> \
-        <input name="resources__${num}__hash" type="text" value="${resource.hash}" class="long" /> \
+        ${resource.id} \
+        <input name="resources__${num}__id" type="hidden" value="${resource.id}" /> \
       </dd> \
     </dl> \
-    <input name="resources__${num}__id" type="hidden" value="${resource.id}" class="long disabled" /> \
   </td> \
   <td class="resource-is-changed"> \
     <img src="/images/icons/add.png" title="This resource has unsaved changes." class="resource-is-changed" /> \


http://bitbucket.org/okfn/ckan/changeset/a6c2253b4d0b/
changeset:   a6c2253b4d0b
user:        rgrp
date:        2011-09-13 23:19:39
summary:     [routing][xs]: (refs #1108) remove route for license page (removed this page as part of new theme work in #1108).
affected #:  1 file (76 bytes)

--- a/ckan/config/routing.py	Tue Sep 13 22:10:57 2011 +0100
+++ b/ckan/config/routing.py	Tue Sep 13 22:19:39 2011 +0100
@@ -30,7 +30,6 @@
         conditions=dict(method=['OPTIONS']))
     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('/locale', controller='home', action='locale')
     map.connect('about', '/about', controller='home', action='about')
 


http://bitbucket.org/okfn/ckan/changeset/bb094f7f6ff5/
changeset:   bb094f7f6ff5
user:        rgrp
date:        2011-09-13 23:25:13
summary:     [merge][s]: merge in minor divergence in default caused by simultaneous activity by myself and dread.
affected #:  4 files (1.1 KB)

--- a/ckan/config/routing.py	Tue Sep 13 22:00:49 2011 +0100
+++ b/ckan/config/routing.py	Tue Sep 13 22:25:13 2011 +0100
@@ -30,7 +30,6 @@
         conditions=dict(method=['OPTIONS']))
     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('/locale', controller='home', action='locale')
     map.connect('about', '/about', controller='home', action='about')
 


--- a/ckan/logic/schema.py	Tue Sep 13 22:00:49 2011 +0100
+++ b/ckan/logic/schema.py	Tue Sep 13 22:25:13 2011 +0100
@@ -31,6 +31,15 @@
 from formencode.validators import OneOf
 import ckan.model
 
+def int_converter(indata):
+    if isinstance(indata, basestring):
+        cleaned = indata.strip()
+        if cleaned != '':
+            return int(indata)
+        else:
+            return None
+    else:
+        return int(indata)
     
 def default_resource_schema():
 
@@ -52,10 +61,10 @@
         '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],
+        'size': [ignore_missing, int_converter],
+        'last_modified': [ignore_empty, isodate],
+        'cache_last_updated': [ignore_empty, isodate],
+        'webstore_last_updated': [ignore_empty, isodate],
         '__extras': [ignore_missing, extras_unicode_convert, keep_extras],
     }
 


--- a/ckan/public/scripts/application.js	Tue Sep 13 22:00:49 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 13 22:25:13 2011 +0100
@@ -369,35 +369,6 @@
 }(jQuery, CKAN.Utils || {});
 
 
-CKAN.View.ResourceAddLink = Backbone.View.extend({
-  initialize: function(options) {
-    _.bindAll(this, 'render');
-    this.mode = options.mode;
-  },
-
-  render: function() {
-    if (this.mode=='file') {
-      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkFile);
-    }
-    else if (this.mode=='api') {
-      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkApi);
-    }
-    $(this.el).html(tmpl);
-    return this;
-  },
-
-  events: {
-    'submit form': 'setResourceInfo',
-  },
-
-  setResourceInfo: function(e) {
-    e.preventDefault();
-    var urlVal=this.el.find('input[name=url]').val();
-    this.model.set({url: urlVal, type: this.mode})
-  }
-});
-
-
 CKAN.View.DatasetEdit = Backbone.View.extend({
   initialize: function() {
     _.bindAll(this, 'render');
@@ -629,3 +600,32 @@
   }
 });
 
+CKAN.View.ResourceAddLink = Backbone.View.extend({
+  initialize: function(options) {
+    _.bindAll(this, 'render');
+    this.mode = options.mode;
+  },
+
+  render: function() {
+    if (this.mode=='file') {
+      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkFile);
+    }
+    else if (this.mode=='api') {
+      var tmpl = $.tmpl(CKAN.Templates.resourceAddLinkApi);
+    }
+    $(this.el).html(tmpl);
+    return this;
+  },
+
+  events: {
+    'submit form': 'setResourceInfo',
+  },
+
+  setResourceInfo: function(e) {
+    e.preventDefault();
+    var urlVal=this.el.find('input[name=url]').val();
+    this.model.set({url: urlVal, resource_type: this.mode})
+  }
+});
+
+


--- a/ckan/public/scripts/templates.js	Tue Sep 13 22:00:49 2011 +0100
+++ b/ckan/public/scripts/templates.js	Tue Sep 13 22:25:13 2011 +0100
@@ -88,44 +88,61 @@
   </td> \
   <td class="resource-expanded" colspan="3"> \
     <dl> \
-      <dt><label class="field_opt">Url</label></dt> \
+      <dt>Name</dt> \
       <dd> \
+        <input name="resources__${num}__name" type="text" value="${resource.name}" class="long" /> \
+      </dd> \
+      <dt>Url</dt> \
+      <dd> \
+      {{if resource.resource_type=="file.upload"}} \
+        ${resource.url} \
+        <input name="resources__${num}__url" type="hidden" value="${resource.url}" /> \
+      {{/if}} \
+      {{if resource.resource_type!="file.upload"}} \
         <input name="resources__${num}__url" type="text" value="${resource.url}" class="long" /> \
+      {{/if}} \
       </dd> \
-      <dt>Type</dt> \
+      <dt>Format</dt> \
       <dd> \
-        ${resource.type} \
+        <input name="resources__${num}__format" type="text" value="${resource.format}" class="long" /> \
+      </dd> \
+      <dt>Description</dt> \
+      <dd> \
+        <input name="resources__${num}__description" type="text" value="${resource.description}" class="long" /> \
+      </dd> \
+      <dt>Size (bytes)</dt> \
+      <dd> \
+        <input name="resources__${num}__size" type="text" value="${resource.size}" class="long" /> \
       </dd> \
       <dt>Mimetype</dt> \
       <dd> \
-        ${resource.mimetype} \
+        <input name="resources__${num}__mimetype" type="text" value="${resource.mimetype}" /> \
       </dd> \
       <dt>Mimetype-inner</dt> \
       <dd> \
-        ${resource.mimetype_inner} \
+        <input name="resources__${num}__mimetype_inner" type="text" value="${resource.mimetype_inner}" /> \
       </dd> \
-      <dt>Size</dt> \
+      <dt>Resource Type</dt> \
       <dd> \
-        ${resource.size} \
+        ${resource.resource_type} \
+        <input name="resources__${num}__resource_type" type="hidden" value="${resource.resource_type}" /> \
+      </dd> \
+      <dt>Hash</dt> \
+      <dd> \
+        ${resource.hash || "Unknown"} \
+        <input name="resources__${num}__hash" type="hidden" value="${resource.hash}" /> \
       </dd> \
       <dt>Last Modified</dt> \
       <dd> \
-        ${resource.lastModified} \
+        ${resource.last_modified || "Unknown"} \
+        <input name="resources__${num}__last_modified" type="hidden" value="${resource.last_modified}" /> \
       </dd> \
-      <dt><label class="field_opt">Format</label></dt> \
+      <dt>ID</dt> \
       <dd> \
-        <input name="resources__${num}__format" type="text" value="${resource.format}" class="long" /> \
-      </dd> \
-      <dt><label class="field_opt">Description</label></dt> \
-      <dd> \
-        <input name="resources__${num}__description" type="text" value="${resource.description}" class="long" /> \
-      </dd> \
-      <dt><label class="field_opt">Hash</label></dt> \
-      <dd> \
-        <input name="resources__${num}__hash" type="text" value="${resource.hash}" class="long" /> \
+        ${resource.id} \
+        <input name="resources__${num}__id" type="hidden" value="${resource.id}" /> \
       </dd> \
     </dl> \
-    <input name="resources__${num}__id" type="hidden" value="${resource.id}" class="long disabled" /> \
   </td> \
   <td class="resource-is-changed"> \
     <img src="/images/icons/add.png" title="This resource has unsaved changes." class="resource-is-changed" /> \

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