Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-v2.0' into canada-v2.0
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/lib/cli.py
  • Loading branch information
wardi committed Apr 22, 2013
2 parents 533b829 + 48a9633 commit 40f1b61
Show file tree
Hide file tree
Showing 146 changed files with 22,965 additions and 12,680 deletions.
15 changes: 7 additions & 8 deletions CONTRIBUTING.rst
Expand Up @@ -5,7 +5,6 @@ Contributing to CKAN
.. _CKAN repo on GitHub: https://github.com/okfn/ckan
.. _CKAN issue tracker: https://github.com/okfn/ckan/issues
.. _docs.ckan.org: http://docs.ckan.org
.. _Contributing to CKAN's Documentation: https://github.com/okfn/ckan/blob/master/CONTRIBUTING.rst#contributing-to-ckans-documentation

(This section is about contributing code, if you want to contribute
documentation see `Contributing to CKAN's Documentation`_.)
Expand All @@ -16,6 +15,13 @@ your code to a feature branch on your fork, then make a pull request for your
branch on the central CKAN repo. We'll go through each step in detail below...


Coding Standards
----------------

When writing code for CKAN, try to follow our
`coding standards <http://docs.ckan.org/en/latest/#for-ckan-developers>`_.


Fork CKAN on GitHub
-------------------

Expand Down Expand Up @@ -133,13 +139,6 @@ When merging a feature or bug branch into master:
- Use the ``--no-ff`` option in the ``git merge`` command,


Coding Standards
----------------

When writing code for CKAN, try to follow our
`coding standards <http://docs.ckan.org/en/latest/#for-ckan-developers>`_.


====================================
Contributing to CKAN's Documentation
====================================
Expand Down
2 changes: 1 addition & 1 deletion ckan/config/deployment.ini_tmpl
Expand Up @@ -193,7 +193,7 @@ ckan.locale_default = en
# within these groups roughly sorted by number of worldwide native speakers
# according to Wikipedia.
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_filtered_out =
ckan.locales_filtered_out = en_GB

## Atom Feeds
#
Expand Down
8 changes: 7 additions & 1 deletion ckan/controllers/api.py
Expand Up @@ -532,6 +532,12 @@ def search(self, ver=None, register=None):
params = search.\
convert_legacy_parameters_to_solr(params)
query = search.query_for(model.Package)

# Remove any existing fq param and set the capacity to
# public
if 'fq' in params:
del params['fq']
params['fq'] = '+capacity:public'
results = query.run(params)
return self._finish_ok(results)
except search.SearchError, e:
Expand Down Expand Up @@ -566,7 +572,7 @@ def _get_search_params(cls, request_params):

def markdown(self, ver=None):
raw_markdown = request.params.get('q', '')
results = ckan.misc.MarkdownFormat().to_html(raw_markdown)
results = h.render_markdown(raw_markdown)

return self._finish_ok(results)

Expand Down
11 changes: 2 additions & 9 deletions ckan/controllers/group.py
Expand Up @@ -176,14 +176,7 @@ def read(self, id):
else:
q += ' groups: "%s"' % c.group_dict.get('name')

try:
description_formatted = ckan.misc.MarkdownFormat().to_html(
c.group_dict.get('description', ''))
c.description_formatted = genshi.HTML(description_formatted)
except Exception, e:
error_msg = "<span class='inline-warning'>%s</span>" %\
_("Cannot render description")
c.description_formatted = genshi.HTML(error_msg)
c.description_formatted = h.render_markdown(c.group_dict.get('description'))

context['return_query'] = True

Expand Down Expand Up @@ -590,7 +583,7 @@ def history(self, id):

context = {'model': model, 'session': model.Session,
'user': c.user or c.author,
'schema': self._form_to_db_schema()}
'schema': self._db_to_form_schema()}
data_dict = {'id': id}
try:
c.group_dict = self._action('group_show')(context, data_dict)
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/home.py
Expand Up @@ -139,7 +139,7 @@ def db_to_form_schema(group_type=None):
global dirty_cached_group_stuff
if not dirty_cached_group_stuff:
groups_data = []
groups = config.get('demo.featured_groups', '').split()
groups = config.get('ckan.featured_groups', '').split()

for group_name in groups:
group = get_group(group_name)
Expand Down
14 changes: 8 additions & 6 deletions ckan/controllers/package.py
Expand Up @@ -27,7 +27,6 @@
flatten_to_string_key)
from ckan.lib.i18n import get_lang
import ckan.rating
import ckan.misc
import ckan.lib.accept as accept
import ckan.lib.helpers as h
import ckan.lib.datapreview as datapreview
Expand Down Expand Up @@ -179,7 +178,6 @@ def _sort_by(fields):
else:
c.sort_by_fields = [field.split()[0]
for field in sort_by.split(',')]
c.sort_by_selected = sort_by

def pager_url(q=None, page=None):
params = list(params_nopage)
Expand Down Expand Up @@ -222,10 +220,13 @@ def pager_url(q=None, page=None):

facets = OrderedDict()

default_facet_titles = {'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license': _('Licence'), }
default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license': _('Licence'),
}

for facet in g.facets:
if facet in default_facet_titles:
Expand All @@ -250,6 +251,7 @@ def pager_url(q=None, page=None):
}

query = get_action('package_search')(context, data_dict)
c.sort_by_selected = query['sort']

c.page = h.Page(
collection=query['results'],
Expand Down
18 changes: 3 additions & 15 deletions ckan/controllers/user.py
Expand Up @@ -3,11 +3,9 @@

from pylons import session, c, g, request, config
from pylons.i18n import _
import genshi

import ckan.lib.i18n as i18n
import ckan.lib.base as base
import ckan.misc as misc
import ckan.model as model
import ckan.lib.helpers as h
import ckan.new_authz as new_authz
Expand Down Expand Up @@ -73,7 +71,7 @@ def _setup_template_variables(self, context, data_dict):
abort(401, _('Not authorized to see this page'))
c.user_dict = user_dict
c.is_myself = user_dict['name'] == c.user
c.about_formatted = self._format_about(user_dict['about'])
c.about_formatted = h.render_markdown(user_dict['about'])

## end hooks

Expand Down Expand Up @@ -573,8 +571,8 @@ def dashboard(self, id=None, offset=0):
context, {'id': c.userobj.id, 'q': q})
c.dashboard_activity_stream_context = self._get_dashboard_context(
filter_type, filter_id, q)
c.dashboard_activity_stream = h.dashboard_activity_stream(
id, filter_type, filter_id, offset)
c.dashboard_activity_stream = h.dashboard_activity_stream(filter_type,
filter_id, offset)

# Mark the user's new activities as old whenever they view their
# dashboard page.
Expand Down Expand Up @@ -620,13 +618,3 @@ def unfollow(self, id):
or e.error_dict)
h.flash_error(error_message)
h.redirect_to(controller='user', action='read', id=id)

def _format_about(self, about):
about_formatted = misc.MarkdownFormat().to_html(about)
try:
html = genshi.HTML(about_formatted)
except genshi.ParseError, e:
log.error('Could not print "about" field Field: %r Error: %r',
about, e)
html = _('Error: Could not parse About text')
return html
Binary file added ckan/i18n/en_GB/LC_MESSAGES/ckan.mo
Binary file not shown.

0 comments on commit 40f1b61

Please sign in to comment.