Skip to content

Commit

Permalink
Merge branch 'master' into 953-bug-creating-a-private-dataset-emits-a…
Browse files Browse the repository at this point in the history
…n-activity

Conflicts:
	ckan/logic/schema.py
	ckan/logic/validators.py
	ckan/public/base/javascript/resource.config
  • Loading branch information
joetsoi committed Jun 28, 2013
2 parents 2ebad5b + e99500b commit 21d99b6
Show file tree
Hide file tree
Showing 279 changed files with 19,864 additions and 8,267 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,3 +1,3 @@
[submodule "doc/_themes/sphinx-theme-okfn"]
path = doc/_themes/sphinx-theme-okfn
url = git://github.com/okfn/sphinx-theme-okfn.git
url = https://github.com/okfn/sphinx-theme-okfn.git
1 change: 1 addition & 0 deletions .pipignore
@@ -0,0 +1 @@
ckan
23 changes: 21 additions & 2 deletions CHANGELOG.rst
@@ -1,9 +1,28 @@
.. _changelog:
.. This tocdepth stops Sphinx from putting every subsection title in this file
into the master table of contents.
:tocdepth: 1

---------
Changelog
---------

v2.0.1 2013-06-11
=================

Bug fixes:
* Use IDatasetForm schema for resource_update (#897)
* Fixes for CKAN being run on a non-root URL (#948, #913)
* Fix resource edit errors losing info (#580)
* Fix Czech translation (#900)
* Allow JSON filters for datastore_search on GET requests (#917)
* Install vdm from the Python Package Index (#764)
* Allow extra parameters on Solr queries (#739)
* Create site user at startup if it does not exist (#952)
* Fix modal popups positioning (#828)
* Fix wrong redirect on dataset form on IE (#963)


v2.0 2013-05-10
===============

Expand Down Expand Up @@ -404,7 +423,7 @@ v1.5 2011-11-07
Major:
* New visual theme (#1108)
* Package & Resource edit overhaul (#1294/#1348/#1351/#1368/#1296)
* JS and CSS reorganisation (#1282, #1349, #1380)
* JS and CSS reorganization (#1282, #1349, #1380)
* Apache Solr used for search in core instead of Postgres (#1275, #1361, #1365)
* Authorization system now embedded in the logic layer (#1253)
* Captcha added for user registration (#1307, #1431)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Expand Up @@ -22,7 +22,7 @@ Note
====

CKAN is sometimes packaged directly with other software (listed in
pip-requirements.txt, pip-requirements-test.txt and pip-requirements-docs.txt).
requirements.txt and dev-requirements.txt).
In these cases, we are required to list the licenses of the packaged softare
too. They are all AGPL compatible and read as follows in the next sections.

Expand Down
1 change: 1 addition & 0 deletions bin/ckan_edit_local.py
Expand Up @@ -84,6 +84,7 @@ def canada_extras():
'Level of Government':'level_of_government',
}
license_mapping = {
# CS: bad_spelling ignore
'http://geogratis.ca/geogratis/en/licence.jsp':'geogratis',
'Crown Copyright':'canada-crown',
}
Expand Down
3 changes: 1 addition & 2 deletions bin/travis-build
Expand Up @@ -23,8 +23,7 @@ sudo -u postgres psql -c "CREATE USER datastore_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;'

pip install -r pip-requirements.txt --use-mirrors
pip install -r pip-requirements-test.txt --use-mirrors
pip install -r requirements.txt -r dev-requirements.txt --use-mirrors

python setup.py develop

Expand Down
2 changes: 1 addition & 1 deletion ckan/__init__.py
@@ -1,4 +1,4 @@
__version__ = '2.1a'
__version__ = '2.2a'

__description__ = 'Comprehensive Knowledge Archive Network (CKAN) Software'
__long_description__ = \
Expand Down
2 changes: 1 addition & 1 deletion ckan/config/deployment.ini_tmpl
Expand Up @@ -107,7 +107,7 @@ ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain a
ckan.locale_default = en
ckan.locale_order = en pt_BR ja it cs_CZ ca es fr el sv sr sr@latin no sk fi ru de pl nl bg ko_KR hu sa sl lv
ckan.locales_offered =
ckan.locales_filtered_out =
ckan.locales_filtered_out = en_GB


## Feeds Settings
Expand Down
5 changes: 4 additions & 1 deletion ckan/config/routing.py
Expand Up @@ -279,7 +279,6 @@ def make_map():
requirements=dict(action='|'.join([
'edit',
'delete',
'members',
'member_new',
'member_delete',
'history',
Expand All @@ -291,6 +290,10 @@ def make_map():
])))
m.connect('group_about', '/group/about/{id}', action='about',
ckan_icon='info-sign'),
m.connect('group_edit', '/group/edit/{id}', action='edit',
ckan_icon='edit')
m.connect('group_members', '/group/members/{id}', action='members',
ckan_icon='group'),
m.connect('group_activity', '/group/activity/{id}/{offset}',
action='activity', ckan_icon='time'),
m.connect('group_read', '/group/{id}', action='read',
Expand Down
62 changes: 40 additions & 22 deletions ckan/controllers/api.py
Expand Up @@ -158,7 +158,7 @@ def action(self, logic_function, ver=None):
except KeyError:
log.error('Can\'t find logic function: %s' % logic_function)
return self._finish_bad_request(
_('Action name not known: %s') % str(logic_function))
_('Action name not known: %s') % logic_function)

context = {'model': model, 'session': model.Session, 'user': c.user,
'api_version': ver}
Expand All @@ -169,25 +169,30 @@ def action(self, logic_function, ver=None):
request_data = self._get_request_data(try_url_params=
side_effect_free)
except ValueError, inst:
log.error('Bad request data: %s' % str(inst))
log.error('Bad request data: %s' % inst)
return self._finish_bad_request(
_('JSON Error: %s') % str(inst))
_('JSON Error: %s') % inst)
if not isinstance(request_data, dict):
# this occurs if request_data is blank
log.error('Bad request data - not dict: %r' % request_data)
return self._finish_bad_request(
_('Bad request data: %s') %
'Request data JSON decoded to %r but '
'it needs to be a dictionary.' % request_data)
# if callback is specified we do not want to send that to the search
if 'callback' in request_data:
del request_data['callback']
try:
result = function(context, request_data)
return_dict['success'] = True
return_dict['result'] = result
except DataError, e:
log.error('Format incorrect: %s - %s' % (e.error, request_data))
#TODO make better error message
return self._finish(400, _(u'Integrity Error') +
': %s - %s' % (e.error, request_data))
return_dict['error'] = {'__type': 'Integrity Error',
'message': e.error,
'data': request_data}
return_dict['success'] = False
return self._finish(400, return_dict, content_type='json')
except NotAuthorized:
return_dict['error'] = {'__type': 'Authorization Error',
'message': _('Access denied')}
Expand All @@ -205,15 +210,9 @@ def action(self, logic_function, ver=None):
error_dict['__type'] = 'Validation Error'
return_dict['error'] = error_dict
return_dict['success'] = False
# CS nasty_string ignore
log.error('Validation error: %r' % str(e.error_dict))
return self._finish(409, return_dict, content_type='json')
except logic.ParameterError, e:
return_dict['error'] = {'__type': 'Parameter Error',
'message': '%s: %s' %
(_('Parameter Error'), e.extra_msg)}
return_dict['success'] = False
log.error('Parameter error: %r' % e.extra_msg)
return self._finish(409, return_dict, content_type='json')
except search.SearchQueryError, e:
return_dict['error'] = {'__type': 'Search Query Error',
'message': 'Search Query is invalid: %r' %
Expand All @@ -225,6 +224,12 @@ def action(self, logic_function, ver=None):
'message': 'Search error: %r' % e.args}
return_dict['success'] = False
return self._finish(409, return_dict, content_type='json')
except search.SearchIndexError, e:
return_dict['error'] = {'__type': 'Search Index Error',
'message': 'Unable to add package to search index: %s' %
str(e)}
return_dict['success'] = False
return self._finish(500, return_dict, content_type='json')
return self._finish_ok(return_dict)

def _get_action_from_map(self, action_map, register, subregister):
Expand All @@ -251,7 +256,7 @@ def list(self, ver=None, register=None, subregister=None, id=None):
'dataset': 'package_list',
'tag': 'tag_list',
'related': 'related_list',
'licenses': 'licence_list',
'licenses': 'license_list',
('dataset', 'relationships'): 'package_relationships_list',
('dataset', 'revisions'): 'package_revision_list',
('dataset', 'activity'): 'package_activity_list',
Expand Down Expand Up @@ -330,7 +335,7 @@ def create(self, ver=None, register=None, subregister=None,
data_dict.update(request_data)
except ValueError, inst:
return self._finish_bad_request(
_('JSON Error: %s') % str(inst))
_('JSON Error: %s') % inst)

action = self._get_action_from_map(action_map, register, subregister)
if not action:
Expand All @@ -353,13 +358,17 @@ def create(self, ver=None, register=None, subregister=None,
extra_msg = e.extra_msg
return self._finish_not_found(extra_msg)
except ValidationError, e:
# CS: nasty_string ignore
log.error('Validation error: %r' % str(e.error_dict))
return self._finish(409, e.error_dict, content_type='json')
except DataError, e:
log.error('Format incorrect: %s - %s' % (e.error, request_data))
#TODO make better error message
return self._finish(400, _(u'Integrity Error') +
': %s - %s' % (e.error, request_data))
error_dict = {
'success': False,
'error': {'__type': 'Integrity Error',
'message': e.error,
'data': request_data}}
return self._finish(400, error_dict, content_type='json')
except search.SearchIndexError:
log.error('Unable to add package to search index: %s' %
request_data)
Expand Down Expand Up @@ -389,7 +398,7 @@ def update(self, ver=None, register=None, subregister=None,
data_dict.update(request_data)
except ValueError, inst:
return self._finish_bad_request(
_('JSON Error: %s') % str(inst))
_('JSON Error: %s') % inst)

action = self._get_action_from_map(action_map, register, subregister)
if not action:
Expand All @@ -405,13 +414,17 @@ def update(self, ver=None, register=None, subregister=None,
extra_msg = e.extra_msg
return self._finish_not_found(extra_msg)
except ValidationError, e:
# CS: nasty_string ignore
log.error('Validation error: %r' % str(e.error_dict))
return self._finish(409, e.error_dict, content_type='json')
except DataError, e:
log.error('Format incorrect: %s - %s' % (e.error, request_data))
#TODO make better error message
return self._finish(400, _(u'Integrity Error') +
': %s - %s' % (e.error, request_data))
error_dict = {
'success': False,
'error': {'__type': 'Integrity Error',
'message': e.error,
'data': request_data}}
return self._finish(400, error_dict, content_type='json')
except search.SearchIndexError:
log.error('Unable to update search index: %s' % request_data)
return self._finish(500, _(u'Unable to update search index') %
Expand Down Expand Up @@ -449,6 +462,7 @@ def delete(self, ver=None, register=None, subregister=None,
extra_msg = e.extra_msg
return self._finish_not_found(extra_msg)
except ValidationError, e:
# CS: nasty_string ignore
log.error('Validation error: %r' % str(e.error_dict))
return self._finish(409, e.error_dict, content_type='json')

Expand Down Expand Up @@ -537,6 +551,10 @@ def search(self, ver=None, register=None):
if 'fq' in params:
del params['fq']
params['fq'] = '+capacity:public'
# if callback is specified we do not want to send that to
# the search
if 'callback' in params:
del params['callback']
results = query.run(params)
return self._finish_ok(results)
except search.SearchError, e:
Expand Down
4 changes: 2 additions & 2 deletions ckan/controllers/group.py
Expand Up @@ -281,7 +281,7 @@ def pager_url(q=None, page=None):
default_facet_titles = {'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license': _('Licence')}
'license_id': _('License')}

for facet in g.facets:
if facet in default_facet_titles:
Expand Down Expand Up @@ -524,7 +524,7 @@ def _save_edit(self, id, context):
if id != group['name']:
self._force_reindex(group)

h.redirect_to('%s_read' % str(group['type']), id=group['name'])
h.redirect_to('%s_read' % group['type'], id=group['name'])
except NotAuthorized:
abort(401, _('Unauthorized to read group %s') % id)
except NotFound, e:
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/home.py
Expand Up @@ -69,7 +69,7 @@ def index(self):
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license': _('Licence'),
'license': _('License'),
}

data_dict = {'sort': 'packages', 'all_fields': 1}
Expand Down
4 changes: 2 additions & 2 deletions ckan/controllers/organization.py
Expand Up @@ -19,7 +19,7 @@ def _group_form(self, group_type=None):
return 'organization/new_organization_form.html'

def _form_to_db_schema(self, group_type=None):
return lookup_group_plugin(group_type).form_to_db_schema()
return group.lookup_group_plugin(group_type).form_to_db_schema()

def _db_to_form_schema(self, group_type=None):
'''This is an interface to manipulate data from the database
Expand Down Expand Up @@ -48,7 +48,7 @@ def _read_template(self, group_type):
return 'organization/read.html'

def _history_template(self, group_type):
return lookup_group_plugin(group_type).history_template()
return group.lookup_group_plugin(group_type).history_template()

def _edit_template(self, group_type):
return 'organization/edit.html'
Expand Down

0 comments on commit 21d99b6

Please sign in to comment.