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

resource_edit incorrectly setting action to new instead of edit. #2710

Merged
merged 1 commit into from Oct 29, 2015

Conversation

TkTech
Copy link
Member

@TkTech TkTech commented Oct 26, 2015

resource_edit incorrectly setting action='new' instead of action='edit'. This value being set properly is required for our extension to behave properly when setting field defaults (we only want to set a default value if action='new').

@@ -590,7 +590,8 @@ def resource_edit(self, id, resource_id, data=None, errors=None,

context = {'model': model, 'session': model.Session,
'api_version': 3, 'for_edit': True,
'user': c.user or c.author, 'auth_user_obj': c.userobj}
'user': c.user or c.author, 'auth_user_obj': c.userobj,
'action': 'edit'}
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the context changes needed for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Simple consistency. If a resource is being edited, the action is edit.

Copy link
Contributor

Choose a reason for hiding this comment

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

But 'action' didn't exist in the context dict before. Is there a reason you're adding it here and below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Simple consistency. If a resource is being edited, the action is edit. O-O

wardi added a commit that referenced this pull request Oct 29, 2015
resource_edit incorrectly setting action to new instead of edit.
@wardi wardi merged commit b255470 into ckan:master Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants