Skip to content

Commit

Permalink
[#3028] Line break fixes and small dict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Dec 19, 2012
1 parent 41e0a7f commit 8a8542c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
11 changes: 6 additions & 5 deletions ckan/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,6 @@ def display_name(followee):
abort(401, _('Unauthorized to read {0} {1}').format(
filter_type, id))

print(followee)

if followee is not None:
return {
'filter_type': filter_type,
Expand Down Expand Up @@ -558,9 +556,12 @@ def dashboard(self, id=None):
filter_type = request.params.get('type', u'')
filter_id = request.params.get('name', u'')

c.followee_list = get_action('followee_list')(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)
c.followee_list = get_action('followee_list')(
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)

# Mark the user's new activities as old whenever they view their
# dashboard page.
Expand Down
23 changes: 16 additions & 7 deletions ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,20 +1180,29 @@ def dashboard_activity_stream(user_id, filter_type=None, filter_id=None):
:param user_id: the id of the user
:type user_id: string
:param filter_type: the type of thing to filter by
:type filter_type: string
:param filter_id: the id of item to filter by
:type filter_id: string
:returns: an activity stream as an HTML snippet
:rtype: string
'''
import ckan.logic as logic
context = {'model': model, 'session': model.Session, 'user': c.user}
if filter_type == 'user':
return logic.get_action('user_activity_list_html')(context, {'id': filter_id})
elif filter_type == 'dataset':
return logic.get_action('package_activity_list_html')(context, {'id': filter_id})
elif filter_type == 'group':
return logic.get_action('group_activity_list_html')(context, {'id': filter_id})
action_functions = {
'dataset': logic.get_action('package_activity_list_html'),
'user': logic.get_action('user_activity_list_html'),
'group': logic.get_action('group_activity_list_html'),
}
action_function = action_functions.get(filter_type)
if action_function is None:
return logic.get_action('dashboard_activity_list_html')(
context, {'id': user_id})
else:
return logic.get_action('dashboard_activity_list_html')(context, {'id': user_id})
return action_function(context, {'id': filter_id})


def escape_js(str_to_escape):
Expand Down

0 comments on commit 8a8542c

Please sign in to comment.