Skip to content

Commit

Permalink
Revert print and fix owner.
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Mar 13, 2017
1 parent 68fd326 commit 880e0b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion pybossa/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def handle_content_type(data):
if 'code' in data.keys():
return jsonify(data), data['code']
else:
print data
return jsonify(data)
else:
template = data['template']
Expand Down
15 changes: 13 additions & 2 deletions pybossa/view/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,9 +1390,20 @@ def show_blogposts(short_name):
ensure_authorized_to('read', Blogpost, project_id=project.id)
pro = pro_features()
project = add_custom_contrib_button_to(project, get_user_id_or_ip())

if current_user.is_authenticated() and owner.id == current_user.id:
project_sanitized = project
owner_sanitized = cached_users.get_user_summary(owner.name)
else: # anonymous or different owner
if request.headers['Content-Type'] == 'application/json':
project_sanitized = Project().to_public_json(project)
else: # HTML
project_sanitized = project
owner_sanitized = cached_users.public_get_user_summary(owner.name)

response = dict(template='projects/blog.html',
project=project,
owner=owner, blogposts=blogposts,
project=project_sanitized,
owner=owner_sanitized, blogposts=blogposts,
overall_progress=overall_progress,
n_tasks=n_tasks,
n_task_runs=n_task_runs,
Expand Down

0 comments on commit 880e0b2

Please sign in to comment.