[ 
https://issues.apache.org/jira/browse/SLING-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680792#action_12680792
 ] 

Andreas Hartmann commented on SLING-883:
----------------------------------------

This makes sense. I patched my sandbox accordingly.

I'm not sure about the configurability, though. Maybe an obscure name would be 
sufficient (convention over configuration), but I'm +0 for making it 
configurable.

> SlingNodeStore.newItem() adds item URI as property
> --------------------------------------------------
>
>                 Key: SLING-883
>                 URL: https://issues.apache.org/jira/browse/SLING-883
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Andreas Hartmann
>            Priority: Minor
>
> SlingNodeStore.newItem() uses the passed item argument directly to create the 
> Sling resource. Since the item has a "uri" field, the corresponding "uri" 
> property of the Sling resource will be set. This causes an exception if the 
> JCR node type doesn't support this property.
> Maybe it makes sense to use a "content" field inside the item object to 
> provide the content:
>   store.newItem({
>     uri: "/foo/bar/baz",
>     content: {
>       "jcr:primaryType": "foo:bar"
>     }
>   });
> Index: src/main/resources/dojox/data/SlingNodeStore.js
> ===================================================================
> --- src/main/resources/dojox/data/SlingNodeStore.js   (revision 752029)
> +++ src/main/resources/dojox/data/SlingNodeStore.js   (working copy)
> @@ -638,7 +638,7 @@
>      
>      var xhr =  xhr = dojo.xhrPost({
>          url: item.uri,
> -        content: item,
> +        content: item.content,
>          load: function(response, ioargs) {
>            item.dirty = false;
>            console.log("onNew");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to