Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

member_list is broken #669

Merged
merged 4 commits into from
Mar 26, 2013
Merged

member_list is broken #669

merged 4 commits into from
Mar 26, 2013

Conversation

johnglover
Copy link
Contributor

Doing an API request with a valid group ID causes a server 500 error with the message:

TypeError: <class 'ckan.model.user.User'> is not JSON serializable (from api controller)

Doing an API request with an invalid group ID causes a server 500 error with the message:

ckan/ckan/logic/action/get.py', line 272 in member_list filter(model.Member.group_id == group.id).\
AttributeError: 'NoneType' object has no attribute 'id'

Now returns lists of (id, type, capacity) tuples
where type is a string. Previously, type was a
Python class object which could not always be
serialized to JSON in the API controller.
Allows a proper error to be generated in the API
controller instead of just giving a 500 error.
@johnglover
Copy link
Contributor Author

@amercader This is another bug to consider for 2.0, cheers.

trans = new_authz.roles_trans()

def translated_capacity(capacity):
try:
return trans[capacity]
Copy link
Contributor

Choose a reason for hiding this comment

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

trans doesn't seem to defined anywhere - do we know what this is about it seems wrong to me - can it just be removed?

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 I'm not sure what you mean, roles_trans is in new_authz. Whether we actually need translations of the capacity value is another thing, I'm not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry - just a case of madness ;p

@ghost ghost assigned amercader Mar 26, 2013
amercader pushed a commit that referenced this pull request Mar 26, 2013
Now returns lists of (id, type, capacity) tuples
where type is a string. Previously, type was a
Python class object which could not always be
serialized to JSON in the API controller.
amercader pushed a commit that referenced this pull request Mar 26, 2013
amercader pushed a commit that referenced this pull request Mar 26, 2013
Allows a proper error to be generated in the API
controller instead of just giving a 500 error.
amercader pushed a commit that referenced this pull request Mar 26, 2013
@amercader amercader merged commit d6e1970 into master Mar 26, 2013
@smotornyuk smotornyuk deleted the 669-member-list-broken branch December 19, 2018 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants