Skip to content

Commit

Permalink
Merge branch 'master' into 2961-pluggable-previews
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/config/deployment.ini_tmpl
  • Loading branch information
domoritz committed Nov 30, 2012
2 parents c6d5389 + 740a0d8 commit e000e0b
Show file tree
Hide file tree
Showing 64 changed files with 3,424 additions and 3,247 deletions.
50 changes: 30 additions & 20 deletions README.rst
@@ -1,35 +1,45 @@
CKAN is open-source data hub software. CKAN makes it easy to publish, share and
work with data. It's a data management system that provides a powerful platform
for cataloging, storing and accessing datasets with a rich front-end, full API
(for both data and catalog), visualization tools and more. Read more at
http://ckan.org/.
CKAN: The Open Source Data Portal Software
==========================================

* Installation instructions: see docs at http://docs.ckan.org/
* Project wiki: http://wiki.ckan.org/
* Developer mailing list: ckan-dev@lists.okfn.org
* Issue tracker: http://trac.ckan.org/
**CKAN is the world’s leading open-source data portal platform**.
CKAN makes it easy to publish, share and work with data. It's a data management
system that provides a powerful platform for cataloging, storing and accessing
datasets with a rich front-end, full API (for both data and catalog), visualization
tools and more. Read more at `ckan.org <http://ckan.org/>`_.

Building Documentation
======================

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

2. Initialize the theme submodule::
See the `CKAN Documentation <http://docs.ckan.org>`_ for installation instructions.

git submodule init
git submodule update

3. Run the command to build the docs::
Community
---------

* Developer mailing list: `ckan-dev@lists.okfn.org <http://lists.okfn.org/mailman/listinfo/ckan-dev>`_
* Developer IRC channel: #ckan on `irc.freenode.net <http://freenode.net/>`_
* Issue tracker: `trac.ckan.org <http://trac.ckan.org/>`_
* `CKAN tag on StackOverflow <http://stackoverflow.com/questions/tagged/ckan>`_


Contributing to CKAN
--------------------

CKAN is a free software project and code contributions are welcome.
The `For CKAN Developers <http://docs.ckan.org/en/latest/index.html#for-ckan-developers>`_
section of the documentation explains how to contribute to CKAN or its documentation,
including our **coding standards**.

The `CKAN Wiki <https://github.com/okfn/ckan/wiki>`_ is also open fo contributions.

python setup.py build_sphinx

Copying and License
===================
-------------------

This material is copyright (c) 2006-2011 Open Knowledge Foundation.

It is open and licensed under the GNU Affero General Public License (AGPL) v3.0
whose full text may be found at:

http://www.fsf.org/licensing/licenses/agpl-3.0.html

http://www.fsf.org/licensing/licenses/agpl-3.0.html
7 changes: 7 additions & 0 deletions ckan/config/deployment.ini_tmpl
Expand Up @@ -244,6 +244,13 @@ ckan.feeds.author_link =
preview.direct = png jpg gif
preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json

# DEBUGGING

# ckan.debug_supress_header This option can be set to suppress the debug
# information showing the controller and action recieving the request being
# shown in the header. Note: This info only shows if debug is set to true.
ckan.debug_supress_header = false

## ===================================
## Extensions

Expand Down
3 changes: 2 additions & 1 deletion ckan/config/routing.py
Expand Up @@ -194,6 +194,7 @@ def make_map():
'history',
'read_ajax',
'history_ajax',
'activity',
'followers',
'follow',
'unfollow',
Expand Down Expand Up @@ -265,7 +266,7 @@ def make_map():
# Note: openid users have slashes in their ids, so need the wildcard
# in the route.
m.connect('/user/activity/{id}', action='activity')
m.connect('/user/dashboard', action='dashboard')
m.connect('/dashboard', action='dashboard')
m.connect('/user/follow/{id}', action='follow')
m.connect('/user/unfollow/{id}', action='unfollow')
m.connect('/user/followers/{id:.*}', action='followers')
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/group.py
Expand Up @@ -342,7 +342,7 @@ def _force_reindex(self, grp):
appearing on the read page for the group (as they're connected via
the group name)'''
group = model.Group.get(grp['name'])
for dataset in group.active_packages().all():
for dataset in group.packages():
search.rebuild(dataset.name)

def _save_edit(self, id, context):
Expand Down
27 changes: 20 additions & 7 deletions ckan/controllers/package.py
Expand Up @@ -321,13 +321,6 @@ def read(self, id, format='html'):
c.current_package_id = c.pkg.id
c.related_count = c.pkg.related_count

# Add the package's activity stream (already rendered to HTML) to the
# template context for the package/read.html template to retrieve
# later.
c.package_activity_stream = \
get_action('package_activity_list_html')(
context, {'id': c.current_package_id})

PackageSaver().render_package(c.pkg_dict, context)

template = self._read_template(package_type)
Expand Down Expand Up @@ -1243,6 +1236,26 @@ def followers(self, id=None):

return render('package/followers.html')

def activity(self, id):
'''Render this package's public activity stream page.'''

context = {'model': model, 'session': model.Session,
'user': c.user or c.author, 'for_view': True}
data_dict = {'id': id}
try:
c.pkg_dict = get_action('package_show')(context, data_dict)
c.pkg = context['package']
c.package_activity_stream = get_action(
'package_activity_list_html')(context,
{'id': c.pkg_dict['id']})
c.related_count = c.pkg.related_count
except NotFound:
abort(404, _('Dataset not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read dataset %s') % id)

return render('package/activity.html')

def resource_embedded_dataviewer(self, id, resource_id,
width=500, height=500):
"""
Expand Down
7 changes: 7 additions & 0 deletions ckan/controllers/user.py
Expand Up @@ -500,6 +500,13 @@ def dashboard(self, id=None):
'user': c.user or c.author, 'for_view': True}
data_dict = {'id': id, 'user_obj': c.userobj}
self._setup_template_variables(context, data_dict)

c.dashboard_activity_stream = h.dashboard_activity_stream(id)

# Mark the user's new activities as old whenever they view their
# dashboard page.
get_action('dashboard_mark_all_new_activities_as_old')(context, {})

return render('user/dashboard.html')

def follow(self, id):
Expand Down
5 changes: 4 additions & 1 deletion ckan/lib/activity_streams.py
@@ -1,4 +1,5 @@
import re
import datetime

from pylons.i18n import _
from webhelpers.html import literal
Expand Down Expand Up @@ -228,10 +229,12 @@ def activity_list_to_html(context, activity_stream):
for match in matches:
snippet = activity_snippet_functions[match](activity, detail)
data[str(match)] = snippet

activity_list.append({'msg': activity_msg,
'type': activity_type.replace(' ', '-').lower(),
'icon': activity_icon,
'data': data,
'timestamp': activity['timestamp']})
'timestamp': activity['timestamp'],
'is_new': activity.get('is_new', False)})
return literal(base.render('activity_streams/activity_stream_items.html',
extra_vars={'activities': activity_list}))
2 changes: 2 additions & 0 deletions ckan/lib/app_globals.py
Expand Up @@ -161,5 +161,7 @@ def _init(self):
datasets_per_page = int(config.get('ckan.datasets_per_page', '20'))
self.datasets_per_page = datasets_per_page

self.debug_supress_header = asbool(config.get('ckan.debug_supress_header', 'false'))

app_globals = _Globals()
del _Globals
10 changes: 10 additions & 0 deletions ckan/lib/base.py
Expand Up @@ -214,6 +214,16 @@ def __before__(self, action, **params):
self._identify_user()
i18n.handle_request(request, c)

# If the user is logged in add their number of new activities to the
# template context.
if c.userobj:
from ckan.logic import get_action
new_activities_count = get_action(
'dashboard_new_activities_count')
context = {'model': model, 'session': model.Session,
'user': c.user or c.author}
c.new_activities = new_activities_count(context, {})

def _identify_user(self):
'''
Identifies the user using two methods:
Expand Down
9 changes: 9 additions & 0 deletions ckan/lib/cli.py
Expand Up @@ -130,6 +130,15 @@ def command(self):
if self.verbose:
print 'Initialising DB: SUCCESS'
elif cmd == 'clean' or cmd == 'drop':

# remove any *.pyc version files to prevent conflicts
v_path = os.path.join(os.path.dirname(__file__),
'..', 'migration', 'versions', '*.pyc')
import glob
filelist = glob.glob(v_path)
for f in filelist:
os.remove(f)

model.repo.clean_db()
search.clear()
if self.verbose:
Expand Down
2 changes: 1 addition & 1 deletion ckan/lib/dictization/model_dictize.py
Expand Up @@ -32,7 +32,7 @@ def group_list_dictize(obj_list, context,
group_dict['display_name'] = obj.display_name

group_dict['packages'] = \
len(obj.active_packages(with_private=with_private).all())
len(obj.packages(with_private=with_private))

if context.get('for_view'):
for item in plugins.PluginImplementations(
Expand Down

0 comments on commit e000e0b

Please sign in to comment.