[ckan-changes] commit/ckan: kindly: [moderated edits] time locale and group preview

Bitbucket commits-noreply at bitbucket.org
Thu Jun 9 10:57:06 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/0aeff06402ea/
changeset:   0aeff06402ea
branch:      feature-1141-moderated-edits-ajax
user:        kindly
date:        2011-06-09 12:56:45
summary:     [moderated edits] time locale and group preview
affected #:  3 files (465 bytes)

--- a/ckan/controllers/package.py	Thu Jun 09 09:09:52 2011 +0100
+++ b/ckan/controllers/package.py	Thu Jun 09 11:56:45 2011 +0100
@@ -9,6 +9,7 @@
 from pylons import config, cache
 from pylons.i18n import get_lang, _
 from autoneg.accept import negotiate
+from babel.dates import format_date, format_datetime, format_time
 
 import ckan.logic.action.create as create
 import ckan.logic.action.update as update
@@ -385,11 +386,18 @@
                 current_approved, approved = True, True
             else:
                 current_approved = False
-            data.append({'revision_id': revision.id,
-                         'message': revision.message,
-                         'timestamp': revision.timestamp.isoformat(),
-                         'approved': bool(revision.approved_timestamp),
-                         'current_approved': current_approved})
+            
+            try:
+                data.append({'revision_id': revision.id,
+                             'message': revision.message,
+                             'timestamp': format_datetime(revision.timestamp, 
+                                                          locale=get_lang()[0] or 'en'),
+                             'approved': bool(revision.approved_timestamp),
+                             'current_approved': current_approved})
+            except Exception, e:
+                from nose.tools import set_trace; set_trace()
+                pass
+                
         response.headers['Content-Type'] = 'application/json;charset=utf-8'
         return json.dumps(data)
 


--- a/ckan/logic/schema.py	Thu Jun 09 09:09:52 2011 +0100
+++ b/ckan/logic/schema.py	Thu Jun 09 11:56:45 2011 +0100
@@ -111,6 +111,7 @@
     schema['groups'] = {
             'id': [not_empty, unicode],
             '__extras': [empty],
+            'name': [ignore, unicode],
     }
     schema['tag_string'] = [ignore_missing, tag_string_convert]
     schema['extras_validation'] = [duplicate_extras_key, ignore]


--- a/ckan/templates/package/new_package_form.html	Thu Jun 09 09:09:52 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Thu Jun 09 11:56:45 2011 +0100
@@ -100,6 +100,7 @@
     <py:for each="num, group in enumerate(data.get('groups', []))"><dt><input type="${'checkbox' if group['id'] in c.groups_authz else 'hidden'}" name="groups__${num}__id" checked="checked" value="${group['id']}" />
+      <input type="hidden" name="groups__${num}__name" value="${group['name']}" /></dt><dd><label for="groups__${num}__checked">${group['name']}</label></dd></py:for>

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