[ckan-changes] commit/ckan: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Jun 10 21:32:41 UTC 2011
2 new changesets in ckan:
http://bitbucket.org/okfn/ckan/changeset/a6b4ffc26c24/
changeset: a6b4ffc26c24
branch: release-v1.4.1
user: kindly
date: 2011-06-10 21:34:23
summary: [forms] stop errors on group preview
affected #: 5 files (392 bytes)
--- a/ckan/logic/action/get.py Fri Jun 10 16:15:14 2011 +0100
+++ b/ckan/logic/action/get.py Fri Jun 10 20:34:23 2011 +0100
@@ -58,7 +58,7 @@
query = ckan.authz.Authorizer().authorized_query(user, model.Group, model.Action.EDIT)
groups = set(query.all())
- return set([group.id for group in groups])
+ return dict((group.id, group.name) for group in groups)
def group_list_availible(context):
model = context['model']
--- a/ckan/logic/action/update.py Fri Jun 10 16:15:14 2011 +0100
+++ b/ckan/logic/action/update.py Fri Jun 10 20:34:23 2011 +0100
@@ -56,7 +56,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)
--- a/ckan/logic/schema.py Fri Jun 10 16:15:14 2011 +0100
+++ b/ckan/logic/schema.py Fri Jun 10 20:34:23 2011 +0100
@@ -106,8 +106,9 @@
##new
schema['log_message'] = [unicode, no_http]
schema['groups'] = {
- 'id': [not_empty, unicode],
+ 'id': [ignore_missing, 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 Fri Jun 10 16:15:14 2011 +0100
+++ b/ckan/templates/package/new_package_form.html Fri Jun 10 20:34:23 2011 +0100
@@ -98,10 +98,11 @@
<legend>Groups</legend><dl><py:for each="num, group in enumerate(data.get('groups', []))">
- <dt>
+ <dt py:if="'id' in group"><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="${c.groups_authz[group['id']]}" /></dt>
- <dd><label for="groups__${num}__checked">${group['name']}</label></dd>
+ <dd py:if="'id' in group"><label for="groups__${num}__checked">${c.groups_authz[group['id']]}</label></dd></py:for><dt>Group</dt>
--- a/ckan/tests/functional/test_package.py Fri Jun 10 16:15:14 2011 +0100
+++ b/ckan/tests/functional/test_package.py Fri Jun 10 20:34:23 2011 +0100
@@ -870,6 +870,8 @@
assert field_name in res
fv = res.forms['package-edit']
fv[prefix + 'groups__0__id'] = grp.id
+ res = fv.submit('preview',extra_environ={'REMOTE_USER':'russianfan'})
+ assert not 'error' in res
res = fv.submit('save', extra_environ={'REMOTE_USER':'russianfan'})
res = res.follow()
pkg = model.Package.by_name(u'editpkgtest')
http://bitbucket.org/okfn/ckan/changeset/840b6788d301/
changeset: 840b6788d301
branch: release-v1.4.1
user: kindly
date: 2011-06-10 23:31:04
summary: [forms] stop errors on group preview fixes
affected #: 1 file (46 bytes)
--- a/ckan/templates/package/new_package_form.html Fri Jun 10 20:34:23 2011 +0100
+++ b/ckan/templates/package/new_package_form.html Fri Jun 10 22:31:04 2011 +0100
@@ -100,9 +100,9 @@
<py:for each="num, group in enumerate(data.get('groups', []))"><dt py:if="'id' in group"><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="${c.groups_authz[group['id']]}" />
+ <input type="hidden" name="groups__${num}__name" value="${group.get('name', c.groups_authz.get(group['id']))}" /></dt>
- <dd py:if="'id' in group"><label for="groups__${num}__checked">${c.groups_authz[group['id']]}</label></dd>
+ <dd py:if="'id' in group"><label for="groups__${num}__checked">${group.get('name', c.groups_authz.get(group['id']))}</label></dd></py:for><dt>Group</dt>
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