We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We have detected an issue that appears to be a bug, and would like to report it below.
Expect child node (a Component) to be created successfully.
Create as a root node (project) instead of a child node(a Component).
Note:
When a template_from is specified in the API, in the NodeSerializer class, the Node is always created as the root Project.
https://github.com/CenterForOpenScience/osf.io/blob/develop/api/nodes/serializers.py#L794-L805
if 'template_from' in validated_data: template_from = validated_data.pop('template_from') template_node = Node.load(template_from) if template_node is None: raise exceptions.NotFound if not template_node.has_permission(user, osf_permissions.READ, check_parent=False): raise exceptions.PermissionDenied validated_data.pop('creator') changed_data = {template_from: validated_data} node = template_node.use_as_template(auth=get_user_auth(request), changes=changed_data) else: node = Node(**validated_data)
If it is other than template_from, specify parent in Node init.
https://github.com/CenterForOpenScience/osf.io/blob/develop/osf/models/node.py#L474-L477
def __init__(self, *args, **kwargs): self._parent = kwargs.pop('parent', None) self._is_templated_clone = False super(AbstractNode, self).__init__(*args, **kwargs)
If template_from and parent Node are specified in the API, one idea is to specify them in node._parent.
RCOSDP@272446a
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We have detected an issue that appears to be a bug, and would like to report it below.
Steps
Expected
Expect child node (a Component) to be created successfully.
Actual
Create as a root node (project) instead of a child node(a Component).
Note:
When a template_from is specified in the API, in the NodeSerializer class, the Node is always created as the root Project.
https://github.com/CenterForOpenScience/osf.io/blob/develop/api/nodes/serializers.py#L794-L805
If it is other than template_from, specify parent in Node init.
https://github.com/CenterForOpenScience/osf.io/blob/develop/osf/models/node.py#L474-L477
If template_from and parent Node are specified in the API, one idea is to specify them in node._parent.
RCOSDP@272446a
The text was updated successfully, but these errors were encountered: