Skip to content

Commit

Permalink
Merge branch 'master' into enhancement-1792-api-logic
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/logic/__init__.py
  • Loading branch information
tobes committed Feb 27, 2012
2 parents 28a80f4 + 7e02ff5 commit ad1a2a1
Show file tree
Hide file tree
Showing 106 changed files with 18,358 additions and 13,573 deletions.
6 changes: 3 additions & 3 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[main]
host = http://www.transifex.net

[ckan.1-5]
[ckan.1-6]
file_filter = ckan/i18n/<lang>/LC_MESSAGES/ckan.po
source_file = ckan/i18n/ckan.pot
source_lang = en
type = PO

# Namings not quite the same in Transifex and babel:
# Transifex vs Babel (& CKAN)
# 'sr@Latin' vs 'sr_Latn'
trans.sr@Latin = ckan/i18n/sr_Latn/LC_MESSAGES/ckan.po
trans.sr@latin = ckan/i18n/sr_Latn/LC_MESSAGES/ckan.po
trans.sr@latin = ckan/i18n/sr_Latn/LC_MESSAGES/ckan.po
51 changes: 49 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
CKAN CHANGELOG
++++++++++++++

v1.5.1 2011-01-04
v1.6 2012-02-24
===============

Major:
* Resources now have their own pages, as well as showing in the Dataset (#1445, #1449)
* Group pages enhanced, including in-group search (#1521)
* User pages enhanced with lists of datasets (#1396) and recent activity (#1515)
* Dataset view page decluttered (#1450)
* Tags not restricted to just letters and dashes (#1453)
* Stats Extension and Storage Extension moved into core CKAN (#1576, #1608)
* Ability to mounting CKAN at a sub-URL (#1401, #1659)
* 5 Stars of Openness ratings show by resources, if ckanext-qa is installed (#1583)
* Recline Data Explorer (for previewing and plotting data) improved and v2 moved into core CKAN (#1602, #1630)

Minor:
* 'About' page rewritten and easily customisable in the config (#1626)
* Gravatar picture displayed next to My Account link (#1528)
* 'Delete' button for datasets (#1425)
* Relationships API more RESTful, validated and documented (#1695)
* User name displayed when logged in (#1529)
* Database dumps now exclude deleted packages (#1623)
* Dataset/Tag name length now limited to 100 characters in API (#1473)
* 'Status' API call now includes installed extensions (#1488)
* Command-line interface for list/read/deleting datasets (#1499)
* Slug API calls tidied up and documented (#1500)
* Users nagged to add email address if missing from their account (#1413)
* Model and API for Users to become Members of a Group in a certain Capacity (#1531, #1477)
* Extension interface to adjust search queries, indexing and results (#1547, #1738)
* API for changing permissions (#1688)

Bug fixes:
* Group deletion didn't work (#1536)
* metadata_created used to return an entirely wrong date (#1546)
* Unicode characters in field-specific API search queries caused exception (since CKAN 1.5) (#1798)
* Sometimes task_status errors weren't being recorded (#1483)
* Registering or Logging in failed silently when already logged in (#1799)
* Deleted packages were browseable by administrators and appeared in dumps (#1283, #1623)
* Facicon was a broken link unless corrected in config file (#1627)
* Dataset search showed last result of each page out of order (#1683)
* 'Simple search' mode showed 0 packages on home page (#1709)
* Occasionally, 'My Account' shows when user is not logged in (#1513)
* Could not change language when on a tag page that had accented characters or dataset creation page (#1783, #1791)
* Editing package via API deleted its relationships (#1786)


v1.5.1 2012-01-04
=================

Major:
Expand All @@ -27,7 +72,7 @@ Minor:
* New config options to ease CSS insertion into the template (#1380)
* Removed ETag browser cache headers (#1422)
* CKAN version number and admin contact in new 'status_show' API (#1087)
* Upgrade SQLAlchemy to 0.7.3 (#1433)
* Upgrade SQLAlchemy to 0.7.3 (compatible with Postgres up to 9.1) (#1433)
* SOLR schema is now versioned (#1498)

Bug fixes:
Expand All @@ -42,6 +87,7 @@ Bug fixes:
* OpenID registration disablement explained better (#1532)
* Data upload (with ckanext-storage) failed if spaces in the filename (#1518)
* Resource download count fixed (integration with ckanext-googleanalytics) (#1451)
* Multiple CKANs with same dataset IDs on the same SOLR core would conflict (#1462)


v1.5 2011-11-07
Expand Down Expand Up @@ -83,6 +129,7 @@ Bug fixes:
* Various minor exceptions cropped up (mostly since 1.4.3) (#1334, #1346)
* Extra field couldn't be set to original value when key deleted (#1356)
* JSONP callback parameter didn't work for the Action API (since 1.4.3) (#1437)
* The same tag could be added to a package multiple times (#1331)


v1.4.3.1 2011-09-30
Expand Down
3 changes: 1 addition & 2 deletions ckan/controllers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,7 @@ def is_slug_valid(self):
if slugtype==u'group':
response_data = dict(valid=not bool(group_exists(slug)))
return self._finish_ok(response_data)
return self._finish_bad_request(gettext('Bad slug type: %s') % slugtype)

return self._finish_bad_request('Bad slug type: %s' % slugtype)

def dataset_autocomplete(self):
q = request.params.get('incomplete', '')
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _save_new(self, context, group_type=None):
except NotAuthorized:
abort(401, _('Unauthorized to read group %s') % '')
except NotFound, e:
abort(404, _('Package not found'))
abort(404, _('Group not found'))
except DataError:
abort(400, _(u'Integrity Error'))
except ValidationError, e:
Expand Down
16 changes: 10 additions & 6 deletions ckan/controllers/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from ckan.lib.hash import get_redirect
from ckan.lib.helpers import url_for

CACHE_PARAMETER = '__cache'

class HomeController(BaseController):
repo = model.repo

Expand Down Expand Up @@ -67,14 +69,16 @@ def index(self):
c.userobj.name.startswith('https://www.google.com/accounts/o8/id')
if not c.userobj.email and (is_google_id and not c.userobj.fullname):
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address and your full name. %s uses'
' your email address if you need to reset your'
' password.''') % (url, g.site_title)
' and add your email address and your full name. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
elif not c.userobj.email:
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address. %s uses your email address'
' if you need to reset your password.') \
% (url, g.site_title)
' and add your email address. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
elif is_google_id and not c.userobj.fullname:
msg = _('Please <a href="%s">update your profile</a>'
' and add your full name.') % (url)
Expand Down
34 changes: 19 additions & 15 deletions ckan/controllers/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ckan.rating
import ckan.misc
import ckan.logic.action.get
from home import CACHE_PARAMETER

from lib.plugins import lookup_package_plugin as _lookup_plugin

Expand Down Expand Up @@ -105,12 +106,13 @@ def pager_url(q=None, page=None):
try:
c.fields = []
search_extras = {}
fq = ''
for (param, value) in request.params.items():
if not param in ['q', 'page'] \
and len(value) and not param.startswith('_'):
if not param.startswith('ext_'):
c.fields.append((param, value))
q += ' %s: "%s"' % (param, value)
fq += ' %s:"%s"' % (param, value)
else:
search_extras[param] = value

Expand All @@ -119,6 +121,7 @@ def pager_url(q=None, page=None):

data_dict = {
'q':q,
'fq':fq,
'facet.field':g.facets,
'rows':limit,
'start':(page-1)*limit,
Expand All @@ -137,7 +140,7 @@ def pager_url(q=None, page=None):
c.facets = query['facets']
c.page.items = query['results']
except SearchError, se:
log.error('Package search error: %r', se.args)
log.error('Dataset search error: %r', se.args)
c.query_error = True
c.facets = {}
c.page = h.Page(collection=[])
Expand Down Expand Up @@ -175,7 +178,7 @@ def read(self, id):
c.pkg = context['package']
c.pkg_json = json.dumps(c.pkg_dict)
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % id)

Expand Down Expand Up @@ -214,7 +217,7 @@ def comments(self, id):
c.pkg_dict = get_action('package_show')(context, {'id':id})
c.pkg = context['package']
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % id)

Expand Down Expand Up @@ -255,16 +258,16 @@ def history(self, id):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))

format = request.params.get('format', '')
if format == 'atom':
# Generate and return Atom 1.0 document.
from webhelpers.feedgenerator import Atom1Feed
feed = Atom1Feed(
title=_(u'CKAN Package Revision History'),
title=_(u'CKAN Dataset Revision History'),
link=h.url_for(controller='revision', action='read', id=c.pkg_dict['name']),
description=_(u'Recent changes to CKAN Package: ') + (c.pkg_dict['title'] or ''),
description=_(u'Recent changes to CKAN Dataset: ') + (c.pkg_dict['title'] or ''),
language=unicode(get_lang()),
)
for revision_dict in c.pkg_revisions:
Expand Down Expand Up @@ -316,7 +319,8 @@ def new(self, data=None, errors=None, error_summary=None):
if context['save'] and not data:
return self._save_new(context)

data = data or clean_dict(unflatten(tuplize_dict(parse_params(request.params))))
data = data or clean_dict(unflatten(tuplize_dict(parse_params(
request.params, ignore_keys=[CACHE_PARAMETER]))))

errors = errors or {}
error_summary = error_summary or {}
Expand Down Expand Up @@ -354,7 +358,7 @@ def edit(self, id, data=None, errors=None, error_summary=None):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))

c.pkg = context.get("package")
c.pkg_json = json.dumps(data)
Expand Down Expand Up @@ -393,7 +397,7 @@ def read_ajax(self, id, revision=None):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))

## hack as db_to_form schema should have this
data['tag_string'] = ', '.join([tag['name'] for tag in data.get('tags', [])])
Expand All @@ -413,7 +417,7 @@ def history_ajax(self, id):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))


data = []
Expand Down Expand Up @@ -453,7 +457,7 @@ def _get_package_type(self, id):
try:
data = get_action('package_show')(context, {'id': id})
except NotFound:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % id)

Expand All @@ -472,7 +476,7 @@ def _save_new(self, context, package_type=None):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % '')
except NotFound, e:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))
except DataError:
abort(400, _(u'Integrity Error'))
except SearchIndexError, e:
Expand Down Expand Up @@ -501,7 +505,7 @@ def _save_edit(self, name_or_id, context):
except NotAuthorized:
abort(401, _('Unauthorized to read package %s') % id)
except NotFound, e:
abort(404, _('Package not found'))
abort(404, _('Dataset not found'))
except DataError:
abort(400, _(u'Integrity Error'))
except SearchIndexError, e:
Expand Down Expand Up @@ -547,7 +551,7 @@ def _adjust_license_id_options(self, pkg, fs):
def authz(self, id):
pkg = model.Package.get(id)
if pkg is None:
abort(404, gettext('Package not found'))
abort(404, gettext('Dataset not found'))
c.pkg = pkg # needed to add in the tab bar to the top of the auth page
c.pkgname = pkg.name
c.pkgtitle = pkg.title
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def list(self):
if revision.message:
item_title += ': %s' % (revision.message or '')
item_link = h.url_for(action='read', id=revision.id)
item_description = _('Packages affected: %s.\n') % pkgs
item_description = _('Datasets affected: %s.\n') % pkgs
item_description += '%s' % (revision.message or '')
item_author_name = revision.author
item_pubdate = revision.timestamp
Expand Down
29 changes: 19 additions & 10 deletions ckan/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

log = logging.getLogger(__name__)

def login_form():
return render('user/login_form.html').replace('FORM_ACTION', '%s')

class UserController(BaseController):

def __before__(self, action, **env):
Expand Down Expand Up @@ -130,6 +127,10 @@ def new(self, data=None, errors=None, error_summary=None):

if context['save'] and not data:
return self._save_new(context)

if c.user and not data:
# #1799 Don't offer the registration form if already logged in
return render('user/logout_first.html')

data = data or {}
errors = errors or {}
Expand Down Expand Up @@ -161,11 +162,16 @@ def _save_new(self, context):
errors = e.error_dict
error_summary = e.error_summary
return self.new(data_dict, errors, error_summary)
# Redirect to a URL picked up by repoze.who which performs the login
h.redirect_to('/login_generic?login=%s&password=%s' % (
str(data_dict['name']),
quote(data_dict['password1'].encode('utf-8'))))

if not c.user:
# Redirect to a URL picked up by repoze.who which performs the login
h.redirect_to('/login_generic?login=%s&password=%s' % (
str(data_dict['name']),
quote(data_dict['password1'].encode('utf-8'))))
else:
# #1799 User has managed to register whilst logged in - warn user
# they are not re-logged in as new user.
h.flash_success(_('User "%s" is now registered but you are still logged in as "%s" from before') % (data_dict['name'], c.user))
return render('user/logout_first.html')

def edit(self, id=None, data=None, errors=None, error_summary=None):
context = {'model': model, 'session': model.Session,
Expand Down Expand Up @@ -244,8 +250,11 @@ def login(self):
# #1662 restriction
log.warn('Cannot mount CKAN at a URL and login with OpenID.')
g.openid_enabled = False

return render('user/login.html')

if not c.user:
return render('user/login.html')
else:
return render('user/logout_first.html')

def logged_in(self):
if c.user:
Expand Down
Binary file modified ckan/i18n/bg/LC_MESSAGES/ckan.mo
Binary file not shown.

0 comments on commit ad1a2a1

Please sign in to comment.