Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/okfn/ckan
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Mar 16, 2012
2 parents 4fb31df + faa8502 commit e975a06
Show file tree
Hide file tree
Showing 52 changed files with 103 additions and 64 deletions.
24 changes: 24 additions & 0 deletions ckan/ckan_nose_plugin.py
Expand Up @@ -5,6 +5,7 @@
import pkg_resources
from paste.deploy import loadapp
from pylons import config
import time

class CkanNose(Plugin):
settings = None
Expand Down Expand Up @@ -65,3 +66,26 @@ def describeTest(self, test):
# display module name instead of docstring
return False

def startTest(self, test):
"""
startTest: start timing.
"""
self._started = time.time()

def stopTest(self, test):
"""
stopTest: stop timing, canonicalize the test name, and save
the run time.
"""
runtime = time.time() - self._started

# CTB: HACK!
f = open('times.txt', 'a')

testname = str(test)
#if ' ' in testname:
# testname = testname.split(' ')[1]

f.write('%s,%s\n' % (testname, str(runtime)))

f.close()
4 changes: 2 additions & 2 deletions ckan/controllers/user.py
Expand Up @@ -130,8 +130,8 @@ def new(self, data=None, errors=None, error_summary=None):

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

data = data or {}
errors = errors or {}
error_summary = error_summary or {}
Expand Down
Binary file modified ckan/i18n/bg/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/ca/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/cs_CZ/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/de/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/el/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/es/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/fi/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/fr/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/hu/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/it/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/lt/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/nl/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/no/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/pl/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/pt_BR/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/ro/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/ru/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/sl/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/sq/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/sr/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/sr_Latn/LC_MESSAGES/ckan.mo
Binary file not shown.
Binary file modified ckan/i18n/sv/LC_MESSAGES/ckan.mo
Binary file not shown.
29 changes: 2 additions & 27 deletions ckan/templates/_util.html
Expand Up @@ -6,6 +6,8 @@
py:strip=""
>

<xi:include href="_util_activity_div.html" />

<!--! Herein can be found generic helper methods for a whole bunch of common
templating issues -->

Expand Down Expand Up @@ -450,33 +452,6 @@
</tr>
</table>

<div py:def="activity_div(actor, verb, object=None, target=None)"
class="activity">
<span class="actor">
${actor}
</span>
<span class="verb">
${verb}
</span>
<py:choose>
<span class="object" py:when="object">
${object}
</span>
<py:otherwise>
</py:otherwise>
</py:choose>
<py:choose>
<span class="target" py:when="target">
${target}
</span>
<py:otherwise>
</py:otherwise>
</py:choose>
<span class="date">
${h.render_datetime(activity.timestamp)}
</span>
</div>

<!--! jsConditionalForIe(ieVersion, tagContent, matchOperator): takes a
IE version number, a tag or other HTML code that will be wrapped inside
a IE conditional comment, and the comparison operator (lt, lte, etc..
Expand Down
34 changes: 34 additions & 0 deletions ckan/templates/_util_activity_div.html
@@ -0,0 +1,34 @@
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<div py:def="activity_div(actor, verb, object=None, target=None)"
class="activity">
<span class="actor">
${actor}
</span>
<span class="verb">
${verb}
</span>
<py:choose>
<span class="object" py:when="object">
${object}
</span>
<py:otherwise>
</py:otherwise>
</py:choose>
<py:choose>
<span class="target" py:when="target">
${target}
</span>
<py:otherwise>
</py:otherwise>
</py:choose>
<span class="date">
${h.render_datetime(activity.timestamp)}
</span>
</div>
</html>
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/added_tag.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='added',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/changed_group.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='updated',
Expand Down
3 changes: 2 additions & 1 deletion ckan/templates/activity_streams/changed_package.html
Expand Up @@ -5,10 +5,11 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='updated',
object="the dataset "+h.dataset_link(activity.data.package),
activity=activity)}

</html>
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/changed_package_extra.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='changed',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/changed_resource.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='updated',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/changed_user.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='updated their profile.',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/deleted_group.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='deleted',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/deleted_package.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='deleted',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/deleted_package_extra.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='deleted',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/deleted_resource.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='deleted',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/new_group.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='created',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/new_package.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='created',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/new_package_extra.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='added',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/new_resource.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='added',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/new_user.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='signed up.',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/removed_tag.html
Expand Up @@ -5,7 +5,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip=""
>
<xi:include href="../_util.html" />
<xi:include href="../_util_activity_div.html" />
${activity_div(
actor=h.linked_user(activity.user_id),
verb='removed',
Expand Down
1 change: 1 addition & 0 deletions ckan/templates/home/about.html
Expand Up @@ -10,6 +10,7 @@ <h2>About ${g.site_title}</h2>

<py:choose>
<py:when test="not g.site_about">

<p i18n:msg="">What was the <a href="http://thedatahub.org/dataset/house-prices-uk-from-1930">average price</a> of a house in the UK in 1935? When will India's projected population <a href="http://thedatahub.org/dataset/guardian-population-unitednations">overtake</a> that of China? Where can you see <a href="http://thedatahub.org/dataset/seattle-public-art">publicly-funded art</a> in Seattle? Data to answer many, many questions like these is out there on the Internet somewhere - but it is not always easy to find.</p>

<p i18n:msg="site_title, site_title">${g.site_title} is a community-run catalogue of useful sets of data on the Internet. You can collect links here to data from around the web for yourself and others to use, or search for data that others have collected. Depending on the type of data (and its conditions of use), ${g.site_title} may also be able to store a copy of the data or host it in a database, and provide some basic visualisation tools.</p>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/database_dumps.rst → doc/database-dumps.rst
@@ -1,7 +1,7 @@
Database Dumps
==============

It's often useful to allow users to download a complete CKAN database in a dumpfile. For example, you can download thedatahub.org's daily dump at: http://thedatahub.org/dump/ in JSON format. The file is called ``ckan.net-daily.json.gz``.
It's often useful to allow users to download a complete CKAN database in a dumpfile.

In addition, a CKAN administrator would like to easily backup and restore a CKAN database.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions doc/index.rst
Expand Up @@ -39,10 +39,10 @@ Publishing Datasets
.. toctree::
:maxdepth: 2

loading_data
loading-data
authorization
storage/filestore
storage/datastore
filestore
datastore

The CKAN API
============
Expand All @@ -60,8 +60,7 @@ General Administration
:maxdepth: 2

paster
database_dumps
i18n
database-dumps
configuration
common-error-messages

Expand All @@ -71,8 +70,9 @@ For CKAN Developers
.. toctree::
:maxdepth: 2

i18n
test
dev/buildbot
buildbot

Other material
==============
Expand Down
File renamed without changes.
24 changes: 12 additions & 12 deletions doc/paster.rst
@@ -1,6 +1,6 @@
=================
Common CKAN Tasks
=================
===============================
Common CKAN Administrator Tasks
===============================

The majority of common CKAN administration tasks are carried out using the **paster** script.

Expand All @@ -20,8 +20,8 @@ At its simplest, paster commands can be thought of like this::

But there are various extra elements to the commandline that usually need adding. We shall build them up:

#. Enabling CKAN commands
=========================
Enabling CKAN commands
======================

Paster is used for many things aside from CKAN. You usually need to tell paster that you want to enable the CKAN commands::

Expand All @@ -31,8 +31,8 @@ You know you need to do this if you get the error ``Command 'user' not known`` f

(Alternatively, CKAN commands are enabled by default if your current directory is the CKAN source directory)

#. Pointing to your CKAN config
===============================
Pointing to your CKAN config
============================

Paster needs to know where your CKAN config file is (so it knows which database and search index to deal with etc.)::

Expand All @@ -46,8 +46,8 @@ For example, to initialise a database::

paster --plugin=ckan db init --config=/etc/ckan/std/std.ini

#. Virtual environments
=======================
Virtual environments
====================

You often need to run paster within your CKAN virtual environment (pyenv). If CKAN was installed as 'source' then you can activate it as usual before running the paster command::

Expand All @@ -59,8 +59,8 @@ The alternative, which also suits a CKAN 'package' install, is to simply give th
/var/lib/ckan/std/pyenv/bin/paster --plugin=ckan db init --config=/etc/ckan/std/std.ini


#. Running Paster on a deployment
=================================
Running Paster on a deployment
==============================

If CKAN is deployed with Apache on this machine, then you should run paster as the same user, which is usually ``www-data``. This is because paster will write to the same CKAN logfile as the Apache process and file permissions need to match.

Expand Down Expand Up @@ -198,7 +198,7 @@ To load it in again, you first have to clean the database of existing data (be c

.. warning: The pg_dump file is a complete backup of the database in plain text, and includes API keys and other user data which may be regarded as private. So keep it secure, like your database server.
The pg_dump file notes which PostgreSQL user 'owns' the data on the server. Because the PostgreSQL user (by default) is identified as the current Linux user, and this is setup to be ``ckanINSTANCE`` where ``INSTANCE`` is the name of the CKAN instance. This means if you want to restore the pg_dump as another CKAN instance name (often needed if you move it to another server) then you will need to change the database owner - see :doc:`editing_the_database_ownership`.
The pg_dump file notes which PostgreSQL user 'owns' the data on the server. Because the PostgreSQL user (by default) is identified as the current Linux user, and this is setup to be ``ckanINSTANCE`` where ``INSTANCE`` is the name of the CKAN instance. This means if you want to restore the pg_dump as another CKAN instance name (often needed if you move it to another server) then you will need to change the database owner - see :doc:`howto-editing--database-ownership`.

Upgrade migration
~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions profile_tests.py
@@ -0,0 +1,4 @@
import nose
import cProfile
command = """nose.main(argv=['--ckan','--with-pylons=test-core.ini', 'ckan/tests', '-x', '-v'])"""
cProfile.runctx( command, globals(), locals(), filename="ckan.profile" )

0 comments on commit e975a06

Please sign in to comment.