[ckan-changes] commit/ckan: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Jun 9 08:10:20 UTC 2011
2 new changesets in ckan:
http://bitbucket.org/okfn/ckan/changeset/2c875390c6a3/
changeset: 2c875390c6a3
branch: feature-1141-moderated-edits-ajax
user: kindly
date: 2011-06-08 22:05:40
summary: [moderated edits] respond to pending flag
affected #: 1 file (283 bytes)
--- a/ckan/controllers/package.py Wed Jun 08 12:37:00 2011 +0100
+++ b/ckan/controllers/package.py Wed Jun 08 21:05:40 2011 +0100
@@ -321,7 +321,8 @@
'user': c.user or c.author, 'extras_as_string': True,
'preview': 'preview' in request.params,
'save': 'save' in request.params,
- 'id': id,
+ 'id': id, 'approved': request.params.get('approved'),
+ 'pending': True,
'schema': self._form_to_db_schema()}
if (context['save'] or context['preview']) and not data:
@@ -423,7 +424,11 @@
tuplize_dict(parse_params(request.params))))
self._check_data_dict(data_dict)
context['message'] = data_dict.get('log_message', '')
+ if not context['approved']:
+ context['pending'] = False
pkg = update.package_update(data_dict, context)
+ if context.get('approved', '') == 'yes':
+ update.make_latest_pending_package_active(context)
c.pkg = context['package']
if context['preview']:
http://bitbucket.org/okfn/ckan/changeset/7a76123b6622/
changeset: 7a76123b6622
branch: feature-1141-moderated-edits-ajax
user: kindly
date: 2011-06-09 10:09:52
summary: [moderated edits] change request handling
affected #: 2 files (86 bytes)
--- a/ckan/controllers/package.py Wed Jun 08 21:05:40 2011 +0100
+++ b/ckan/controllers/package.py Thu Jun 09 09:09:52 2011 +0100
@@ -321,7 +321,7 @@
'user': c.user or c.author, 'extras_as_string': True,
'preview': 'preview' in request.params,
'save': 'save' in request.params,
- 'id': id, 'approved': request.params.get('approved'),
+ 'id': id, 'moderated': request.params.get('moderated'),
'pending': True,
'schema': self._form_to_db_schema()}
@@ -388,6 +388,7 @@
data.append({'revision_id': revision.id,
'message': revision.message,
'timestamp': revision.timestamp.isoformat(),
+ 'approved': bool(revision.approved_timestamp),
'current_approved': current_approved})
response.headers['Content-Type'] = 'application/json;charset=utf-8'
return json.dumps(data)
@@ -424,10 +425,10 @@
tuplize_dict(parse_params(request.params))))
self._check_data_dict(data_dict)
context['message'] = data_dict.get('log_message', '')
- if not context['approved']:
+ if not context['moderated']:
context['pending'] = False
pkg = update.package_update(data_dict, context)
- if context.get('approved', '') == 'yes':
+ if request.params.get('save', '') == 'Approve':
update.make_latest_pending_package_active(context)
c.pkg = context['package']
--- a/ckan/logic/action/update.py Wed Jun 08 21:05:40 2011 +0100
+++ b/ckan/logic/action/update.py Thu Jun 09 09:09:52 2011 +0100
@@ -107,7 +107,7 @@
check_access(pkg, model.Action.EDIT, context)
#packages
- q = session.query(model.PackageRevision).filter_by(id=id)
+ q = session.query(model.PackageRevision).filter_by(id=pkg.id)
_make_latest_rev_active(context, q)
#resources
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