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 15, 2012
2 parents 8ced6f6 + 497ecb4 commit 43eed1b
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 48 deletions.
6 changes: 3 additions & 3 deletions README.rst
Expand Up @@ -12,12 +12,12 @@ http://ckan.org/.
Building Documentation
======================

1. Install python-sphinx
1. Install python-sphinx (>= 1.1)

2. Initialize the theme submodule::

git submodule init
git submodule update
git submodule init
git submodule update

3. Run the command to build the docs::

Expand Down
41 changes: 41 additions & 0 deletions ckan/lib/create_test_data.py
Expand Up @@ -11,6 +11,8 @@ class CreateTestData(cli.CkanCommand):
create-test-data gov - government style data
create-test-data family - package relationships data
create-test-data user - create a user 'tester' with api key 'tester'
create-test-data vocabs - annakerenina, warandpeace, and some test
vocabularies
'''
summary = __doc__.split('\n')[0]
usage = __doc__
Expand Down Expand Up @@ -51,6 +53,8 @@ def command(self):
self.create_gov_test_data()
elif cmd == 'family':
self.create_family_test_data()
elif cmd == 'vocabs':
self.create_vocabs_test_data()
else:
print 'Command %s not recognized' % cmd
raise NotImplementedError
Expand Down Expand Up @@ -87,6 +91,43 @@ def create_test_user(cls):
model.Session.remove()
cls.user_refs.append(u'tester')

@classmethod
def create_vocabs_test_data(cls):
import ckan.model
CreateTestData.create()
sysadmin_user = ckan.model.User.get('testsysadmin')
annakarenina = ckan.model.Package.get('annakarenina')
warandpeace = ckan.model.Package.get('warandpeace')

# Create a couple of vocabularies.
context = {
'model': ckan.model,
'session': ckan.model.Session,
'user': sysadmin_user.name
}
data_dict = {
'name': 'Genre',
'tags': [{'name': 'Drama'}, {'name': 'Sci-Fi'},
{'name': 'Mystery'}],
}
ckan.logic.action.create.vocabulary_create(context, data_dict)

data_dict = {
'name': 'Actors',
'tags': [{'name': 'keira-knightley'}, {'name': 'jude-law'},
{'name': 'alessio-boni'}],
}
ckan.logic.action.create.vocabulary_create(context, data_dict)

# Add some vocab tags to some packages.
genre_vocab = ckan.model.Vocabulary.get('Genre')
actors_vocab = ckan.model.Vocabulary.get('Actors')
annakarenina.add_tag_by_name('Drama', vocab=genre_vocab)
annakarenina.add_tag_by_name('keira-knightley', vocab=actors_vocab)
annakarenina.add_tag_by_name('jude-law', vocab=actors_vocab)
warandpeace.add_tag_by_name('Drama', vocab=genre_vocab)
warandpeace.add_tag_by_name('alessio-boni', vocab=actors_vocab)

@classmethod
def create_arbitrary(cls, package_dicts, relationships=[],
extra_user_names=[], extra_group_names=[],
Expand Down
15 changes: 7 additions & 8 deletions ckan/templates/package/resource_read.html
Expand Up @@ -105,6 +105,13 @@
</dd>
<dt>Licence</dt>
<dd>
<py:choose test="">
<span py:when="c.pkg.license and c.pkg.license.url"><a
href="${c.pkg.license.url}" rel="dc:rights">${c.pkg.license.title.split('::')[-1]}</a></span>
<span py:when="c.pkg.license" property="dc:rights">${c.pkg.license.title}</span>
<span py:when="c.pkg.license_id" property="dc:rights">${c.pkg.license_id}</span>
<span py:when="not(c.pkg.license)">License unknown</span>
</py:choose>
<py:if test="c.pkg.isopen()">
<a href="http://opendefinition.org/okd/" title="This dataset satisfies the Open Definition.">
<img class="open-data" src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" alt="[Open Data]" />
Expand All @@ -115,14 +122,6 @@
${h.icon('lock')}
</span>
</py:if>

<py:choose test="">
<span py:when="c.pkg.license and c.pkg.license.url"><a
href="${c.pkg.license.url}" rel="dc:rights">${c.pkg.license.title.split('::')[-1]}</a></span>
<span py:when="c.pkg.license" property="dc:rights">${c.pkg.license.title}</span>
<span py:when="c.pkg.license_id" property="dc:rights">${c.pkg.license_id}</span>
<span py:when="not(c.pkg.license)">License unknown</span>
</py:choose>
</dd>
</dl>
</div>
Expand Down
66 changes: 43 additions & 23 deletions doc/apiv3.rst
Expand Up @@ -63,9 +63,10 @@ group_list_authz (none)
group_list_available (none)
group_revision_list id
licence_list (none)
tag_list q, all_fields, limit, offset, return_objects
tag_list q, all_fields, limit, offset, return_objects, vocabulary_id
user_list q, order_by
package_relationships_list id, id2, rel
vocabulary_list (none)
package_show id
revision_show id
group_show id
Expand All @@ -74,12 +75,15 @@ user_show id
package_show_rest id
group_show_rest id
tag_show_rest id
vocabulary_show id
package_autocomplete q
tag_autocomplete q, limit
tag_autocomplete q, fields, offset, limit, vocabulary_id
format_autocomplete q, limit
user_autocomplete q, limit
package_search q, fields, facet_by, limit, offset
tag_search q, fields, offset, limit, vocabulary_id
roles_show domain_object, (user), (authorization_group)

====================================== ===========================

new.py:
Expand All @@ -96,6 +100,8 @@ rating_create package, rating
user_create (user keys)
package_create_rest (package keys)
group_create_rest (group keys)
vocabulary_create (vocabulary keys)
tag_create (tag keys)
====================================== ===========================

update.py:
Expand All @@ -114,6 +120,7 @@ package_update_rest (package keys)
group_update_rest (group keys)
user_role_update user OR authorization_group, domain_object, roles
user_role_bulk_update user_roles, domain_object
vocabulary_update (vocabulary keys)
====================================== ===========================

delete.py:
Expand All @@ -124,6 +131,8 @@ Logic Action Parameter keys
package_delete id
package_relationship_delete id, id2, rel
group_delete id
vocabulary_delete id
tag_delete id, vocabulary_id
====================================== ===========================

In case of doubt, refer to the code of the logic actions, which is found in the CKAN source in the ckan/logic/action directory.
Expand All @@ -133,28 +142,28 @@ Object dictionaries

Package:

======================== ====================================== =============
key example value notes
======================== ====================================== =============
id "fd788e57-dce4-481c-832d-497235bf9f78" (Read-only) unique identifier
name "uk-spending" Unique identifier. Should be human readable
title "UK Spending" Human readable title of the dataset
url "http://gov.uk/spend-downloads.html" Home page for the data
version "1.0" Version associated with the data. String format.
author "UK Treasury" Name of person responsible for the data
author_email "contact@treasury.gov.uk" Email address for the person in the 'author' field
maintainer null Name of another person responsible for the data
maintainer_email null Email address for the person in the 'maintainer' field
notes "### About\\r\\n\\r\\nUpdated 1997." Other human readable info about the dataset. Markdown format.
license_id "cc-by" ID of the license this dataset is released under. You can then look up the license ID to get the title.
======================== ====================================================== =============
key example value notes
======================== ====================================================== =============
id "fd788e57-dce4-481c-832d-497235bf9f78" (Read-only) unique identifier
name "uk-spending" Unique identifier. Should be human readable
title "UK Spending" Human readable title of the dataset
url "http://gov.uk/spend-downloads.html" Home page for the data
version "1.0" Version associated with the data. String format.
author "UK Treasury" Name of person responsible for the data
author_email "contact@treasury.gov.uk" Email address for the person in the 'author' field
maintainer null Name of another person responsible for the data
maintainer_email null Email address for the person in the 'maintainer' field
notes "### About\\r\\n\\r\\nUpdated 1997." Other human readable info about the dataset. Markdown format.
license_id "cc-by" ID of the license this dataset is released under. You can then look up the license ID to get the title.
extras []
tags ["government-spending"] List of tags associated with this dataset.
groups ["spending", "country-uk"] List of groups this dataset is a member of.
relationships_as_subject [] List of relationships. The 'type' of the relationship is described in terms of this package being the subject and the related package being the object.
state active May be ``deleted`` or other custom states like ``pending``.
revision_id "f645243a-7334-44e2-b87c-64231700a9a6" (Read-only) ID of the last revision for the core package object was (doesn't include tags, groups, extra fields, relationships).
revision_timestamp "2010-12-21T15:26:17.345502" (Read-only) Time and date when the last revision for the core package object was (doesn't include tags, groups, extra fields, relationships). ISO format. UTC timezone assumed.
======================== ====================================== =============
tags [{"name": "government-spending"}, {"name": "climate"}] List of tags associated with this dataset.
groups [{"name": "spending"}, {"name": "country-uk"}] List of groups this dataset is a member of.
relationships_as_subject [] List of relationships. The 'type' of the relationship is described in terms of this package being the subject and the related package being the object.
state active May be ``deleted`` or other custom states like ``pending``.
revision_id "f645243a-7334-44e2-b87c-64231700a9a6" (Read-only) ID of the last revision for the core package object was (doesn't include tags, groups, extra fields, relationships).
revision_timestamp "2010-12-21T15:26:17.345502" (Read-only) Time and date when the last revision for the core package object was (doesn't include tags, groups, extra fields, relationships). ISO format. UTC timezone assumed.
======================== ====================================================== =============

Package Extra:

Expand Down Expand Up @@ -197,6 +206,7 @@ id "b10871ea-b4ae-4e2e-bec9-a8d8ff357754" (Read-only)
name "country-uk" (Read-only) Add/remove tags from a package or group using update_package or update_group
state "active" (Read-only) Add/remove tags from a package or group using update_package or update_group
revision_timestamp "2009-08-08T12:46:40.920443" (Read-only)
vocabulary_id "Genre" (Read-only) Vocabulary name or id. Optional.
======================== ====================================== =============

user_roles:
Expand All @@ -209,6 +219,16 @@ authorization_group "16f8f7ba-1a97-4d27-95ce-5e8827a0d75f"
roles ['editor', 'admin']
======================== ====================================== =============

Vocabulary:

======================== ===================================================== =============
key example value notes
======================== ===================================================== =============
id "b10871ea-b4ae-4e2e-bec9-a8d8ff357754" (Read-only)
name "Genre"
tags [{"name":"government-spending"}, {"name": "climate"}] List of tags belonging to this vocabulary.
======================== ===================================================== =============

Parameters
==========

Expand Down
2 changes: 1 addition & 1 deletion doc/install-from-source.rst
Expand Up @@ -126,7 +126,7 @@ WebOb has to be installed explicitly afterwards because by installing pylons wit
Now to install the remaining dependencies in requires/lucid_present.txt and you are using Ubuntu Lucid 10.04 you can install the system versions::

sudo apt-get install python-pybabel python-psycopg2 python-lxml
sudo apt-get install python-sphinx python-pylons python-repoze.who
sudo apt-get install python-pylons python-repoze.who
sudo apt-get install python-repoze.who-plugins python-tempita python-zope.interface
Alternatively, if you are not using Ubuntu Lucid 10.04 you'll need to install them like this:
Expand Down
11 changes: 0 additions & 11 deletions pip-requirements-prerelease.txt

This file was deleted.

3 changes: 1 addition & 2 deletions requires/lucid_present.txt
Expand Up @@ -3,13 +3,12 @@
# you can install these dependencies via pip instead.
#
# sudo apt-get install python-pybabel python-psycopg2 python-lxml
# sudo apt-get install python-sphinx python-pylons python-repoze.who
# sudo apt-get install python-pylons python-repoze.who
# sudo apt-get install python-repoze.who-plugins python-tempita python-zope.interface

babel==0.9.4
psycopg2==2.0.13
lxml==2.2.4
sphinx==0.6.4
# Specifying particular version of WebOb because later version has incompatibility
# with pylons 0.9.7 (change to imports of Multidict)
webob==1.0.8
Expand Down

0 comments on commit 43eed1b

Please sign in to comment.