Skip to content

Commit

Permalink
Merge branch 'master' into 1701-date-field-index
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/new_tests/lib/search/test_index.py
  • Loading branch information
joetsoi committed Jul 23, 2014
2 parents 9cf1497 + 922af51 commit 0722f1b
Show file tree
Hide file tree
Showing 438 changed files with 21,184 additions and 12,253 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -7,6 +7,29 @@
Changelog
---------

v2.3
====

API changes and deprecations
----------------------------

* ``helpers.get_action()`` (or ``h.get_action()`` in templates) is deprecated.

Since action functions raise exceptions and templates cannot catch
exceptions, it's not a good idea to call action functions from templates.

Instead, have your controller method call the action function and pass the
result to your template using the ``extra_vars`` param of ``render()``.

Alternatively you can wrap individual action functions in custom template
helper functions that handle any exceptions appropriately, but this is likely
to make your the logic in your templates more complex and templates are
difficult to test and debug.

Note that logic.get_action() and toolkit.get_action() are *not* deprecated,
core code and plugin code should still use ``get_action()``.


v2.2 2014-02-04
===============

Expand Down
58 changes: 58 additions & 0 deletions Dockerfile
@@ -0,0 +1,58 @@
FROM phusion/baseimage:0.9.10
MAINTAINER Open Knowledge

# Disable SSH
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh

ENV HOME /root
ENV CKAN_HOME /usr/lib/ckan/default
ENV CKAN_CONFIG /etc/ckan/default
ENV CKAN_DATA /var/lib/ckan

# Install required packages
RUN apt-get -q -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -q -y install \
python-minimal \
python-dev \
python-virtualenv \
libevent-dev \
libpq-dev \
nginx-light \
apache2 \
libapache2-mod-wsgi \
postfix \
build-essential

# Install CKAN
RUN virtualenv $CKAN_HOME
RUN mkdir -p $CKAN_HOME $CKAN_CONFIG $CKAN_DATA
RUN chown www-data:www-data $CKAN_DATA

ADD ./requirements.txt $CKAN_HOME/src/ckan/requirements.txt
RUN $CKAN_HOME/bin/pip install -r $CKAN_HOME/src/ckan/requirements.txt
ADD . $CKAN_HOME/src/ckan/
RUN $CKAN_HOME/bin/pip install -e $CKAN_HOME/src/ckan/
RUN ln -s $CKAN_HOME/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini
ADD ./contrib/docker/apache.wsgi $CKAN_CONFIG/apache.wsgi

# Configure apache
ADD ./contrib/docker/apache.conf /etc/apache2/sites-available/ckan_default.conf
RUN echo "Listen 8080" > /etc/apache2/ports.conf
RUN a2ensite ckan_default
RUN a2dissite 000-default

# Configure nginx
ADD ./contrib/docker/nginx.conf /etc/nginx/nginx.conf
RUN mkdir /var/cache/nginx

# Configure postfix
ADD ./contrib/docker/main.cf /etc/postfix/main.cf

# Configure runit
ADD ./contrib/docker/svc /etc/service
CMD ["/sbin/my_init"]

VOLUME ["/var/lib/ckan"]
EXPOSE 80

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2 changes: 1 addition & 1 deletion bin/travis-install-dependencies
Expand Up @@ -45,7 +45,7 @@ paster db init -c test-core.ini
if [ $PGVERSION != '8.4' ]
then
sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/datastore_default:pass@\/datastore_test/' test-core.ini
paster datastore set-permissions postgres -c test-core.ini
paster datastore -c test-core.ini set-permissions | sudo -u postgres psql
else
sed -i -e 's/.*datastore.read_url.*//' test-core.ini
fi
Expand Down
7 changes: 4 additions & 3 deletions ckan/config/deployment.ini_tmpl
Expand Up @@ -48,6 +48,8 @@ sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default
#ckan.datastore.write_url = postgresql://ckan_default:pass@localhost/datastore_default
#ckan.datastore.read_url = postgresql://datastore_default:pass@localhost/datastore_default

# Default Postgres' full-text search index language
ckan.datastore.default_fts_lang = english

## Site Settings

Expand Down Expand Up @@ -80,10 +82,10 @@ ckan.site_id = default

# Note: Add ``datastore`` to enable the CKAN DataStore
# Add ``datapusher`` to enable DataPusher
# Add ``pdf_preview`` to enable the resource preview for PDFs
# Add ``pdf_view`` to enable the resource views for PDFs
# Add ``resource_proxy`` to enable resorce proxying and get around the
# same origin policy
ckan.plugins = stats text_preview recline_preview
ckan.plugins = stats text_view recline_view


## Front-End Settings
Expand All @@ -110,7 +112,6 @@ ckan.locale_order = en pt_BR ja it cs_CZ ca es fr el sv sr sr@latin no sk fi ru
ckan.locales_offered =
ckan.locales_filtered_out = en_GB


## Feeds Settings

ckan.feeds.authority_name =
Expand Down
8 changes: 8 additions & 0 deletions ckan/config/middleware.py
Expand Up @@ -29,6 +29,7 @@
from ckan.config.environment import load_environment
import ckan.lib.app_globals as app_globals

log = logging.getLogger(__name__)

def make_app(conf, full_stack=True, static_files=True, **app_conf):
"""Create a Pylons WSGI application and return it
Expand Down Expand Up @@ -94,6 +95,13 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
}
app = Fanstatic(app, **fanstatic_config)

for plugin in PluginImplementations(IMiddleware):
try:
app = plugin.make_error_log_middleware(app, config)
except AttributeError:
log.critical('Middleware class {0} is missing the method'
'make_error_log_middleware.'.format(plugin.__class__.__name__))

if asbool(full_stack):
# Handle Python exceptions
app = ErrorHandler(app, conf, **config['pylons.errorware'])
Expand Down
15 changes: 15 additions & 0 deletions ckan/config/routing.py
Expand Up @@ -265,6 +265,18 @@ def make_map():
height="800")
m.connect('/dataset/{id}/resource/{resource_id}/preview',
action='resource_datapreview')
m.connect('views', '/dataset/{id}/resource/{resource_id}/views',
action='resource_views', ckan_icon='reorder')
m.connect('new_view', '/dataset/{id}/resource/{resource_id}/new_view',
action='edit_view', ckan_icon='edit')
m.connect('edit_view',
'/dataset/{id}/resource/{resource_id}/edit_view/{view_id}',
action='edit_view', ckan_icon='edit')
m.connect('resource_view',
'/dataset/{id}/resource/{resource_id}/view/{view_id}',
action='resource_view')
m.connect('/dataset/{id}/resource/{resource_id}/view/',
action='resource_view')

# group
map.redirect('/groups', '/group')
Expand Down Expand Up @@ -349,6 +361,7 @@ def make_map():
m.connect('/user/edit', action='edit')
# Note: openid users have slashes in their ids, so need the wildcard
# in the route.
m.connect('user_generate_apikey', '/user/generate_key/{id}', action='generate_apikey')
m.connect('/user/activity/{id}/{offset}', action='activity')
m.connect('user_activity_stream', '/user/activity/{id}',
action='activity', ckan_icon='time')
Expand Down Expand Up @@ -401,6 +414,8 @@ def make_map():
action='index', ckan_icon='legal')
map.connect('ckanadmin_config', '/ckan-admin/config', controller='admin',
action='config', ckan_icon='check')
map.connect('ckanadmin_trash', '/ckan-admin/trash', controller='admin',
action='trash', ckan_icon='trash')
map.connect('ckanadmin', '/ckan-admin/{action}', controller='admin')

# Storage routes
Expand Down
2 changes: 2 additions & 0 deletions ckan/config/solr/schema.xml
Expand Up @@ -136,6 +136,7 @@
<dynamicField name="*_date" type="date" indexed="true" stored="true" multiValued="false"/>

<dynamicField name="extras_*" type="text" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="res_extras_*" type="text" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="vocab_*" type="string" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*" type="string" indexed="true" stored="false"/>
</fields>
Expand All @@ -149,6 +150,7 @@
<copyField source="download_url" dest="urls"/>
<copyField source="res_url" dest="urls"/>
<copyField source="extras_*" dest="text"/>
<copyField source="res_extras_*" dest="text"/>
<copyField source="vocab_*" dest="text"/>
<copyField source="urls" dest="text"/>
<copyField source="name" dest="text"/>
Expand Down
1 change: 1 addition & 0 deletions ckan/config/who.ini
Expand Up @@ -11,6 +11,7 @@ logout_handler_path = /user/logout
rememberer_name = auth_tkt
post_login_url = /user/logged_in
post_logout_url = /user/logged_out
charset = utf-8

#[plugin:basicauth]
#use = repoze.who.plugins.basicauth:make_plugin
Expand Down

0 comments on commit 0722f1b

Please sign in to comment.