Skip to content

Commit

Permalink
[#368] Add num_followers after validating the group_dict against a …
Browse files Browse the repository at this point in the history
…schema.

This makes sure that is still there and is necessary because we require a schema in controllers.group.history but there is no `num_followers` field in logic.schema.default_group_schema.
  • Loading branch information
domoritz committed Feb 20, 2013
1 parent 87c6938 commit c81edd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ckan/logic/action/get.py
Expand Up @@ -845,12 +845,12 @@ def _group_or_org_show(context, data_dict, is_org=False):
except AttributeError:
schema = group_plugin.db_to_form_schema()

if schema:
group_dict, errors = _validate(group_dict, schema, context=context)

group_dict['num_followers'] = logic.get_action('group_follower_count')(
{'model': model, 'session': model.Session},
{'id': group_dict['id']})

if schema:
group_dict, errors = _validate(group_dict, schema, context=context)
return group_dict


Expand Down

1 comment on commit c81edd2

@domoritz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobes Could you look at this and let me know if it makes sense. Also read my commit message.

I'm not sure whether it might be better to change the schema, for example.

Without this change, the group revision page shows an error: UndefinedError: 'dict object' has no attribute 'num_followers'.

Please sign in to comment.