Skip to content

Commit

Permalink
Merge branch 'master' into pep8-lib-helpers
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/lib/helpers.py

    trivial merge
  • Loading branch information
tobes committed Aug 16, 2012
2 parents 85097d9 + 8f7baad commit ec53e97
Show file tree
Hide file tree
Showing 103 changed files with 62,070 additions and 24,246 deletions.
2 changes: 1 addition & 1 deletion .tx/config
@@ -1,7 +1,7 @@
[main]
host = http://www.transifex.net

[ckan.1-7]
[ckan.1-8]
file_filter = ckan/i18n/<lang>/LC_MESSAGES/ckan.po
source_file = ckan/i18n/ckan.pot
source_lang = en
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -30,6 +30,7 @@ v1.8
available by `setting ckan.restrict_template_vars = false` in your
.ini config file. Only restricted functions will be allowed in
future versions of CKAN.
* [#2842] Allow sort ordering of dataset listings on group pages

API changes and deprecation:
* [#2313] Deprecated functions related to the old faceting data structure have
Expand Down
2 changes: 1 addition & 1 deletion ckan/__init__.py
@@ -1,4 +1,4 @@
__version__ = '1.9a'
__version__ = '1.8b'
__description__ = 'Comprehensive Knowledge Archive Network (CKAN) Software'
__long_description__ = \
'''CKAN software provides a hub for datasets. The flagship site running CKAN
Expand Down
4 changes: 3 additions & 1 deletion ckan/config/environment.py
Expand Up @@ -16,7 +16,6 @@
import ckan.model as model
import ckan.plugins as p
import ckan.lib.helpers as h
import ckan.lib.search as search
import ckan.lib.app_globals as app_globals

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -161,6 +160,9 @@ def find_controller(self, controller):

# Init SOLR settings and check if the schema is compatible
#from ckan.lib.search import SolrSettings, check_solr_schema_version

# lib.search is imported here as we need the config enabled and parsed
import ckan.lib.search as search
search.SolrSettings.init(config.get('solr_url'),
config.get('solr_user'),
config.get('solr_password'))
Expand Down
11 changes: 8 additions & 3 deletions ckan/controllers/group.py
Expand Up @@ -34,7 +34,7 @@ def _form_to_db_schema(self, group_type=None):
def _db_to_form_schema(self, group_type=None):
'''This is an interface to manipulate data from the database
into a format suitable for the form (optional)'''
return lookup_group_plugin(group_type).form_to_db_schema()
return lookup_group_plugin(group_type).db_to_form_schema()

def _setup_template_variables(self, context, data_dict, group_type=None):
return lookup_group_plugin(group_type).\
Expand Down Expand Up @@ -100,7 +100,7 @@ def read(self, id):
group_type = self._get_group_type(id.split('@')[0])
context = {'model': model, 'session': model.Session,
'user': c.user or c.author,
'schema': self._form_to_db_schema(group_type=group_type),
'schema': self._db_to_form_schema(group_type=group_type),
'for_view': True, 'extras_as_string': True}
data_dict = {'id': id}
# unicode format (decoded from utf8)
Expand Down Expand Up @@ -139,6 +139,7 @@ def read(self, id):
# most search operations should reset the page counter:
params_nopage = [(k, v) for k, v in request.params.items()
if k != 'page']
sort_by = request.params.get('sort', None)

def search_url(params):
url = h.url_for(controller='group', action='read',
Expand Down Expand Up @@ -170,7 +171,7 @@ def pager_url(q=None, page=None):
c.fields = []
search_extras = {}
for (param, value) in request.params.items():
if not param in ['q', 'page'] \
if not param in ['q', 'page', 'sort'] \
and len(value) and not param.startswith('_'):
if not param.startswith('ext_'):
c.fields.append((param, value))
Expand All @@ -188,6 +189,7 @@ def pager_url(q=None, page=None):
'fq': fq,
'facet.field': g.facets,
'rows': limit,
'sort': sort_by,
'start': (page - 1) * limit,
'extras': search_extras
}
Expand All @@ -209,6 +211,9 @@ def pager_url(q=None, page=None):

c.search_facets = query['search_facets']
c.page.items = query['results']

c.sort_by_selected = sort_by

except SearchError, se:
log.error('Group search error: %r', se.args)
c.query_error = True
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/storage.py
Expand Up @@ -270,7 +270,7 @@ def get_metadata(self, label):
qualified=False
)
if url.startswith('/'):
url = config.get('ckan.site_url','') + url
url = config.get('ckan.site_url','').rstrip('/') + '/' + url

if not self.ofs.exists(bucket, label):
abort(404)
Expand Down
12 changes: 7 additions & 5 deletions ckan/controllers/user.py
Expand Up @@ -107,10 +107,6 @@ def read(self, id=None):
abort(401, _('Not authorized to see this page'))

context['with_related'] = True
try:
user_dict = get_action('user_show')(context,data_dict)
except NotFound:
h.redirect_to(controller='user', action='login', id=None)

self._setup_template_variables(context, data_dict)

Expand Down Expand Up @@ -388,12 +384,18 @@ def request_reset(self):

def perform_reset(self, id):
context = {'model': model, 'session': model.Session,
'user': c.user}
'user': c.user,
'keep_sensitive_data': True}

data_dict = {'id': id}

try:
user_dict = get_action('user_show')(context, data_dict)

# Be a little paranoid, and get rid of sensitive data that's
# not needed.
user_dict.pop('apikey', None)
user_dict.pop('reset_key', None)
user_obj = context['user_obj']
except NotFound, e:
abort(404, _('User not found'))
Expand Down
Binary file modified ckan/i18n/bg/LC_MESSAGES/ckan.mo
Binary file not shown.

0 comments on commit ec53e97

Please sign in to comment.