[ckan-changes] commit/ckan: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Jun 9 21:50:08 UTC 2011
2 new changesets in ckan:
http://bitbucket.org/okfn/ckan/changeset/2c30311cfb29/
changeset: 2c30311cfb29
branch: feature-1141-moderated-edits-ajax
user: kindly
date: 2011-06-09 19:58:44
summary: [moderated edits] change authz to accept pending and group bug
affected #: 4 files (136 bytes)
--- a/ckan/authz.py Thu Jun 09 12:46:29 2011 +0100
+++ b/ckan/authz.py Thu Jun 09 18:58:44 2011 +0100
@@ -73,7 +73,7 @@
# check it's active
if domain_object.__class__ != type and hasattr(domain_object, 'state'):
- if domain_object.state != model.State.ACTIVE:
+ if domain_object.state == model.State.DELETED:
return False
# check if any of the roles allows the action requested
@@ -209,13 +209,13 @@
q = q.filter(sa.or_(
sa.and_(role_cls.role==model.RoleAction.role,
model.RoleAction.action==action,
- state and state==model.State.ACTIVE),
+ state and state!=model.State.DELETED),
role_cls.role==model.Role.ADMIN))
else:
q = q.filter(
sa.and_(role_cls.role==model.RoleAction.role,
model.RoleAction.action==action,
- state and state==model.State.ACTIVE),
+ state and state!=model.State.DELETED),
)
q = q.filter(sa.or_(*filters))
q = q.distinct()
--- a/ckan/logic/action/update.py Thu Jun 09 12:46:29 2011 +0100
+++ b/ckan/logic/action/update.py Thu Jun 09 18:58:44 2011 +0100
@@ -57,7 +57,10 @@
group_dicts = data_dict.get("groups", [])
groups = set()
for group_dict in group_dicts:
- grp = model.Group.get(group_dict['id'])
+ id = group_dict.get('id')
+ if not id:
+ continue
+ grp = model.Group.get(id)
if grp is None:
raise NotFound(_('Group was not found.'))
groups.add(grp)
@@ -153,10 +156,11 @@
raise NotFound(_('Package was not found.'))
check_access(pkg, model.Action.EDIT, context)
- check_group_auth(data_dict, context)
data, errors = validate(data_dict, schema, context)
+ check_group_auth(data, context)
+
if errors:
model.Session.rollback()
raise ValidationError(errors, package_error_summary(errors))
--- a/ckan/logic/schema.py Thu Jun 09 12:46:29 2011 +0100
+++ b/ckan/logic/schema.py Thu Jun 09 18:58:44 2011 +0100
@@ -109,7 +109,7 @@
##new
schema['log_message'] = [unicode, no_http]
schema['groups'] = {
- 'id': [not_empty, unicode],
+ 'id': [ignore_missing, unicode],
'__extras': [empty],
'name': [ignore, unicode],
}
--- a/ckan/model/modification.py Thu Jun 09 12:46:29 2011 +0100
+++ b/ckan/model/modification.py Thu Jun 09 18:58:44 2011 +0100
@@ -52,6 +52,8 @@
related_packages = obj.related_packages()
except AttributeError:
continue
+ if 'pending' in obj.state:
+ continue
# this is needed to sort out vdm bug where pkg.as_dict does not
# work when the package is deleted.
for package in related_packages:
http://bitbucket.org/okfn/ckan/changeset/8939d28dc811/
changeset: 8939d28dc811
branch: release-v1.4.1
user: kindly
date: 2011-06-09 23:49:46
summary: [controller] bookmarklet fix
affected #: 1 file (19 bytes)
--- a/ckan/controllers/package.py Wed Jun 08 17:55:35 2011 +0100
+++ b/ckan/controllers/package.py Thu Jun 09 22:49:46 2011 +0100
@@ -304,7 +304,7 @@
if (context['save'] or context['preview']) and not data:
return self._save_new(context)
- data = data or {}
+ data = data or dict(request.params)
errors = errors or {}
error_summary = error_summary or {}
vars = {'data': data, 'errors': errors, 'error_summary': error_summary}
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