[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Description: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? {code} >From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 18 Mar 2016 18:17:00 +0100 Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 See https://issues.apache.org/jira/browse/CMIS-971 --- src/cmislib/browser/binding.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 79ae297..c9cc8a3 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:folder" propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop.key -props["propertyValue[%s]" % propCount] = prop +for key, val in properties.items(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = val propCount += 1 # invoke the URL {code} see https://github.com/lmignon/chemistry-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unified was: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > With the dev version of cmislib when using the browser binding. If you > provide a properties dict to the createFolder method, the following error > will raise > {code} > File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 1387, in createFolder > return parentFolder.createFolder(name, properties, **kwargs) > File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 2051, in createFolder > props["propertyId[%s]" % propCount] = prop.key > AttributeError: 'str' object has no attribute 'key' > {code} > Moreover, the code seems to be not actively developed and the git mirror is > outdated. How can I contribute efficiently. I'll provide a patch as soon as > I've finished to mirror your svn repo to github? > {code} > From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 > From: Laurent Mignon > Date: Fri, 18 Mar 2016 18:17:00 +0100 > Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 > See https://issues.apache.org/jira/browse/CMIS-971 > --- > src/cmislib/browser/binding.py | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index 79ae297..c9cc8a3 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -2043,13 +2043,14 @@ def createFolde
[jira] [Created] (CMIS-971) Error when calling createFolder with properties parameter
Laurent Mignon created CMIS-971: --- Summary: Error when calling createFolder with properties parameter Key: CMIS-971 URL: https://issues.apache.org/jira/browse/CMIS-971 Project: Chemistry Issue Type: Bug Components: python-cmislib Affects Versions: cmislib 0.5.1 Environment: Linux, python 2.7.x, Alfresco 4.0.x Reporter: Laurent Mignon Assignee: Jeff Potts When setting adding an empty string for a multiple valued property, the we got IndexError error because Alfresco returns and cmislib does valnode.children[0] in both, cmislib and cmislibalf, during xmlDoc parsing. Adding a try ... except: IndexError: pass resolves the problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Affects Version/s: (was: cmislib 0.5.1) > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > When setting adding an empty string for a multiple valued property, the we > got IndexError error because Alfresco returns and cmislib does > valnode.children[0] in both, cmislib and cmislibalf, during xmlDoc parsing. > Adding a try ... except: IndexError: pass resolves the problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Description: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? was: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to no bet actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > With the dev version of cmislib when using the browser binding. If you > provide a properties dict to the createFolder method, the following error > will raise > {code} > File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 1387, in createFolder > return parentFolder.createFolder(name, properties, **kwargs) > File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 2051, in createFolder > props["propertyId[%s]" % propCount] = prop.key > AttributeError: 'str' object has no attribute 'key' > {code} > Moreover, the code seems to be not actively developed and the git mirror is > outdated. How can I contribute efficiently. I'll provide a patch as soon as > I've finished to mirror your svn repo to github? -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Environment: Linux, python 2.7.x, Alfresco 5.0.x (was: Linux, python 2.7.x, Alfresco 4.0.x) > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Affects Versions: cmislib 0.5.1 > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > When setting adding an empty string for a multiple valued property, the we > got IndexError error because Alfresco returns and cmislib does > valnode.children[0] in both, cmislib and cmislibalf, during xmlDoc parsing. > Adding a try ... except: IndexError: pass resolves the problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Description: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to no bet actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? was: When setting adding an empty string for a multiple valued property, the we got IndexError error because Alfresco returns and cmislib does valnode.children[0] in both, cmislib and cmislibalf, during xmlDoc parsing. Adding a try ... except: IndexError: pass resolves the problem. > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > With the dev version of cmislib when using the browser binding. If you > provide a properties dict to the createFolder method, the following error > will raise > {code} > File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 1387, in createFolder > return parentFolder.createFolder(name, properties, **kwargs) > File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 2051, in createFolder > props["propertyId[%s]" % propCount] = prop.key > AttributeError: 'str' object has no attribute 'key' > {code} > Moreover, the code seems to no bet actively developed and the git mirror is > outdated. How can I contribute efficiently. I'll provide a patch as soon as > I've finished to mirror your svn repo to github? -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-971) Error when calling createFolder with properties parameter
[ https://issues.apache.org/jira/browse/CMIS-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-971: Description: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? {code} >From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 18 Mar 2016 18:17:00 +0100 Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 See https://issues.apache.org/jira/browse/CMIS-971 --- src/cmislib/browser/binding.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 79ae297..c9cc8a3 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:folder" propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop.key -props["propertyValue[%s]" % propCount] = prop +for key, val in properties.items(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = val propCount += 1 # invoke the URL {code} see https://github.com/lmignon/python-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unified was: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? {code} >From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 18 Mar 2016 18:17:00 +0100 Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 See https://issues.apache.org/jira/browse/CMIS-971 --- src/cmislib/browser/binding.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 79ae297..c9cc8a3 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:folder" propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop.key -props["propertyValue[%s]" % propCount] = prop +for key, val in properties.items(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = val propCount += 1 # invoke the URL {code} see https://github.com/lmignon/chemistry-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unified > Error when calling createFolder with properties parameter > - > > Key: CMIS-971 > URL: https://issues.apache.org/jira/browse/CMIS-971 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent
[jira] [Created] (CMIS-972) Implement contentSream and properties update in BrowserDocument.checkin method
Laurent Mignon created CMIS-972: --- Summary: Implement contentSream and properties update in BrowserDocument.checkin method Key: CMIS-972 URL: https://issues.apache.org/jira/browse/CMIS-972 Project: Chemistry Issue Type: Bug Components: python-cmislib Environment: Linux, python 2.7.x, Alfresco 5.0.x Reporter: Laurent Mignon Assignee: Jeff Potts With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? {code} >From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 18 Mar 2016 18:17:00 +0100 Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 See https://issues.apache.org/jira/browse/CMIS-971 --- src/cmislib/browser/binding.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 79ae297..c9cc8a3 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:folder" propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop.key -props["propertyValue[%s]" % propCount] = prop +for key, val in properties.items(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = val propCount += 1 # invoke the URL {code} see https://github.com/lmignon/python-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-972) Implement contentSream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-972: Issue Type: Improvement (was: Bug) > Implement contentSream and properties update in BrowserDocument.checkin method > -- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > With the dev version of cmislib when using the browser binding. If you > provide a properties dict to the createFolder method, the following error > will raise > {code} > File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 1387, in createFolder > return parentFolder.createFolder(name, properties, **kwargs) > File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", > line 2051, in createFolder > props["propertyId[%s]" % propCount] = prop.key > AttributeError: 'str' object has no attribute 'key' > {code} > Moreover, the code seems to be not actively developed and the git mirror is > outdated. How can I contribute efficiently. I'll provide a patch as soon as > I've finished to mirror your svn repo to github? > {code} > From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 > From: Laurent Mignon > Date: Fri, 18 Mar 2016 18:17:00 +0100 > Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 > See https://issues.apache.org/jira/browse/CMIS-971 > --- > src/cmislib/browser/binding.py | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index 79ae297..c9cc8a3 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): > props["propertyId[1]"] = "cmis:objectTypeId" > if properties.has_key('cmis:objectTypeId'): > props["propertyValue[1]"] = properties['cmis:objectTypeId'] > +del properties['cmis:objectTypeId'] > else: > props["propertyValue[1]"] = "cmis:folder" > > propCount = 2 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop.key > -props["propertyValue[%s]" % propCount] = prop > +for key, val in properties.items(): > +props["propertyId[%s]" % propCount] = key > +props["propertyValue[%s]" % propCount] = val > propCount += 1 > > # invoke the URL > {code} > see > https://github.com/lmignon/python-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-972) Implement contentSream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-972: Description: I've improved the checkin method to allow to update the content stream and the properties {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index c9cc8a3..b340eda 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1743,7 +1743,8 @@ class BrowserDocument(BrowserCmisObject): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None,ntStream - policies - addACEs - removeACEs """ -# TODO implement optional arguments -# major = true is supposed to be the default but inmemory 0.9 is throwing an error 500 without it if not kwargs.has_key('major'): kwargs['major'] = 'true' +else: +kwargs['major'] = 'false' +props = { +'checkinComment': checkinComment, +} +props.update(kwargs) +propCount = 0 +properties = properties or {} +for key, value in properties.iteritems(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = value +propCount += 1 -kwargs['checkinComment'] = checkinComment - -ciUrl = self._repository.getRootFolderUrl() +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" -# TODO don't hardcode major flag -props = {"objectId": self.id, - "cmisaction": "checkIn"} +contentType, body = encode_multipart_formdata(props, contentFile, contentType) # invoke the URL result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), - urlencode(props), - 'application/x-www-form-urlencoded', + body, + contentType, self._cmisClient.username, - self._cmisClient.password, - **kwargs) + self._cmisClient.password) return getSpecializedObject(BrowserCmisObject(self._cmisClient, self._repository, data=result)) {code} https://github.com/lmignon/python-cmislib/commit/c1ff31b82c6768148e18e766a9cbc5d62bfb5b23?diff=unified was: With the dev version of cmislib when using the browser binding. If you provide a properties dict to the createFolder method, the following error will raise {code} File "../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 1387, in createFolder return parentFolder.createFolder(name, properties, **kwargs) File ".../local/lib/python2.7/site-packages/cmislib/browser/binding.py", line 2051, in createFolder props["propertyId[%s]" % propCount] = prop.key AttributeError: 'str' object has no attribute 'key' {code} Moreover, the code seems to be not actively developed and the git mirror is outdated. How can I contribute efficiently. I'll provide a patch as soon as I've finished to mirror your svn repo to github? {code} >From 203330f499a508427a6b3ae7b7b0f402797ecc01 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 18 Mar 2016 18:17:00 +0100 Subject: [PATCH] In createFolder 'properties' param is a dict Fixes CMIS-971 See https://issues.apache.org/jira/browse/CMIS-971 --- src/cmislib/browser/binding.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 79ae297..c9cc8a3 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -2043,13 +2043,14 @@ def createFolder(self, name, properties={}, **kwargs): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:folder" propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop.key -props["propertyValue[%s]" % propCount] = prop +for key, val in properties.items(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = val propCount += 1 # invoke the URL {code} see https://github.com/lmignon/python-cmislib/commit/203330f499a508427a6b3ae7b7b0f402797ecc01?diff=unif
[jira] [Updated] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-972: Summary: Implement contentStream and properties update in BrowserDocument.checkin method (was: Implement contentSream and properties update in BrowserDocument.checkin method) > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index c9cc8a3..b340eda 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1743,7 +1743,8 @@ class BrowserDocument(BrowserCmisObject): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None,ntStream > - policies > - addACEs > - removeACEs > """ > -# TODO implement optional arguments > -# major = true is supposed to be the default but inmemory 0.9 is > throwing an error 500 without it > if not kwargs.has_key('major'): > kwargs['major'] = 'true' > +else: > +kwargs['major'] = 'false' > +props = { > +'checkinComment': checkinComment, > +} > +props.update(kwargs) > +propCount = 0 > +properties = properties or {} > +for key, value in properties.iteritems(): > +props["propertyId[%s]" % propCount] = key > +props["propertyValue[%s]" % propCount] = value > +propCount += 1 > > -kwargs['checkinComment'] = checkinComment > - > -ciUrl = self._repository.getRootFolderUrl() > +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > -# TODO don't hardcode major flag > -props = {"objectId": self.id, > - "cmisaction": "checkIn"} > +contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > # invoke the URL > result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), > - urlencode(props), > - > 'application/x-www-form-urlencoded', > + body, > + contentType, > self._cmisClient.username, > - self._cmisClient.password, > - **kwargs) > + self._cmisClient.password) > > return getSpecializedObject(BrowserCmisObject(self._cmisClient, > self._repository, data=result)) > {code} > https://github.com/lmignon/python-cmislib/commit/c1ff31b82c6768148e18e766a9cbc5d62bfb5b23?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15212028#comment-15212028 ] Laurent Mignon commented on CMIS-972: - Do I've to also implement the functionality in the AtomPub binding? What's the motivation to keep the 2 bindings? I'll have no times to do the changes the next week but maybe the week after. Regards, lmi > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index c9cc8a3..b340eda 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1743,7 +1743,8 @@ class BrowserDocument(BrowserCmisObject): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None,ntStream > - policies > - addACEs > - removeACEs > """ > -# TODO implement optional arguments > -# major = true is supposed to be the default but inmemory 0.9 is > throwing an error 500 without it > if not kwargs.has_key('major'): > kwargs['major'] = 'true' > +else: > +kwargs['major'] = 'false' > +props = { > +'checkinComment': checkinComment, > +} > +props.update(kwargs) > +propCount = 0 > +properties = properties or {} > +for key, value in properties.iteritems(): > +props["propertyId[%s]" % propCount] = key > +props["propertyValue[%s]" % propCount] = value > +propCount += 1 > > -kwargs['checkinComment'] = checkinComment > - > -ciUrl = self._repository.getRootFolderUrl() > +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > -# TODO don't hardcode major flag > -props = {"objectId": self.id, > - "cmisaction": "checkIn"} > +contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > # invoke the URL > result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), > - urlencode(props), > - > 'application/x-www-form-urlencoded', > + body, > + contentType, > self._cmisClient.username, > - self._cmisClient.password, > - **kwargs) > + self._cmisClient.password) > > return getSpecializedObject(BrowserCmisObject(self._cmisClient, > self._repository, data=result)) > {code} > https://github.com/lmignon/python-cmislib/commit/c1ff31b82c6768148e18e766a9cbc5d62bfb5b23?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15238712#comment-15238712 ] Laurent Mignon commented on CMIS-972: - [~jpotts] am I wrong when I say that it's not possible to update at the same time the properties and the content of a document by using the atompub binding (regarding the CMIS specifications)? Therefore, how can we keep the 2 protocols interchangeable if one provide less functionalities than the other? May be I'm wrong in the way I understand the specifications of the AtomPub binding... Regards, lmi > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index c9cc8a3..b340eda 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1743,7 +1743,8 @@ class BrowserDocument(BrowserCmisObject): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None,ntStream > - policies > - addACEs > - removeACEs > """ > -# TODO implement optional arguments > -# major = true is supposed to be the default but inmemory 0.9 is > throwing an error 500 without it > if not kwargs.has_key('major'): > kwargs['major'] = 'true' > +else: > +kwargs['major'] = 'false' > +props = { > +'checkinComment': checkinComment, > +} > +props.update(kwargs) > +propCount = 0 > +properties = properties or {} > +for key, value in properties.iteritems(): > +props["propertyId[%s]" % propCount] = key > +props["propertyValue[%s]" % propCount] = value > +propCount += 1 > > -kwargs['checkinComment'] = checkinComment > - > -ciUrl = self._repository.getRootFolderUrl() > +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > -# TODO don't hardcode major flag > -props = {"objectId": self.id, > - "cmisaction": "checkIn"} > +contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > # invoke the URL > result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), > - urlencode(props), > - > 'application/x-www-form-urlencoded', > + body, > + contentType, > self._cmisClient.username, > - self._cmisClient.password, > - **kwargs) > + self._cmisClient.password) > > return getSpecializedObject(BrowserCmisObject(self._cmisClient, > self._repository, data=result)) > {code} > https://github.com/lmignon/python-cmislib/commit/c1ff31b82c6768148e18e766a9cbc5d62bfb5b23?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15238726#comment-15238726 ] Laurent Mignon commented on CMIS-972: - [~jpotts]I'm wrong, by looking into the java implementation it seems that the checkin can be done by using the HTTP PUT method of an XML document with the properties and the contentStrean serialized in base64. Do you confirm? > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index c9cc8a3..b340eda 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1743,7 +1743,8 @@ class BrowserDocument(BrowserCmisObject): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None,ntStream > - policies > - addACEs > - removeACEs > """ > -# TODO implement optional arguments > -# major = true is supposed to be the default but inmemory 0.9 is > throwing an error 500 without it > if not kwargs.has_key('major'): > kwargs['major'] = 'true' > +else: > +kwargs['major'] = 'false' > +props = { > +'checkinComment': checkinComment, > +} > +props.update(kwargs) > +propCount = 0 > +properties = properties or {} > +for key, value in properties.iteritems(): > +props["propertyId[%s]" % propCount] = key > +props["propertyValue[%s]" % propCount] = value > +propCount += 1 > > -kwargs['checkinComment'] = checkinComment > - > -ciUrl = self._repository.getRootFolderUrl() > +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > -# TODO don't hardcode major flag > -props = {"objectId": self.id, > - "cmisaction": "checkIn"} > +contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > # invoke the URL > result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), > - urlencode(props), > - > 'application/x-www-form-urlencoded', > + body, > + contentType, > self._cmisClient.username, > - self._cmisClient.password, > - **kwargs) > + self._cmisClient.password) > > return getSpecializedObject(BrowserCmisObject(self._cmisClient, > self._repository, data=result)) > {code} > https://github.com/lmignon/python-cmislib/commit/c1ff31b82c6768148e18e766a9cbc5d62bfb5b23?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
Laurent Mignon created CMIS-979: --- Summary: Allow to use multi valued values in properties when using the Browser Binding Key: CMIS-979 URL: https://issues.apache.org/jira/browse/CMIS-979 Project: Chemistry Issue Type: Bug Components: python-cmislib Reporter: Laurent Mignon The browser binding on the trunk doesn't support multi valued values for properties. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-979: Description: The browser binding on the trunk doesn't support multi valued values for properties. https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 was:The browser binding on the trunk doesn't support multi valued values for properties. > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon > > The browser binding on the trunk doesn't support multi valued values for > properties. > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-979: Description: The browser binding on the trunk doesn't support multi valued values for properties. {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 was: The browser binding on the trunk doesn't support multi valued values for properties. https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon > > The browser binding on the trunk doesn't support multi valued values for > properties. > {code} > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 > {code} > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-979: Description: The browser binding on the trunk doesn't support multi valued values for properties. {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index b340eda..8565be0 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -352,13 +352,7 @@ class BrowserCmisObject(object): updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id props = {"cmisaction": "update"} - -propCount = 0 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 - +setProps(properties, props, initialIndex=0) # invoke the URL result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), urlencode(props), @@ -1325,14 +1319,11 @@ class BrowserRepository(object): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:document" -propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 +setProps(properties, props, initialIndex=2) contentType, body = encode_multipart_formdata(props, contentFile, contentType) @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): props.update(kwargs) propCount = 0 properties = properties or {} -for key, value in properties.iteritems(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = value -propCount += 1 +setProps(properties, props, initialIndex=0) ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): else: props["propertyValue[1]"] = "cmis:folder" -propCount = 2 -for key, val in properties.items(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = val -propCount += 1 +setProps(properties, props, initialIndex=2) # invoke the URL result = self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): pass +def setProps(properties, props, initialIndex=0): +""" +Transform key, value from properties into props list items in the format +expected by the HTTP POST request +""" +i = initialIndex +for key, val in properties.items(): +props["propertyId[%s]" % i] = key +if hasattr(val, '__iter__'): +j = 0 +for v in val: +props["propertyValue[%s][%s]" % (i, j)] = v +j += 1 +else: +props["propertyValue[%s]" % i] = val +i += 1 + + def getSpecializedObject(obj, **kwargs): """ {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 was: The browser binding on the trunk doesn't support multi valued values for properties. {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon > > The browser binding on the trunk doesn't support multi valued values for > properties. > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index b340eda..8565be0 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -352,13 +352,7 @@ class BrowserCmisObject(object): > updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + > self.id > > props = {"cmisaction": "update"} > - > -propCount = 0 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > - > +
[jira] [Commented] (CMIS-961) Connection reset by peer when trying to upload a document over 2M to Alfresco 5.0.d
[ https://issues.apache.org/jira/browse/CMIS-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15296143#comment-15296143 ] Laurent Mignon commented on CMIS-961: - Can you provide the name of the missing parameters PLZ. Thank you in advance, lmi > Connection reset by peer when trying to upload a document over 2M to Alfresco > 5.0.d > --- > > Key: CMIS-961 > URL: https://issues.apache.org/jira/browse/CMIS-961 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Affects Versions: cmislib 0.5.1 > Environment: Alfresco 5.0.d community edition on an Ubuntu 14.04 LTS > based system. >Reporter: Willem Ligtenberg >Assignee: Jeff Potts > Attachments: Sample-Bigish.pdf, Sample-Smallish.pdf > > > Using Alfresco 5.0.a I was able to store large data files (up to 250M tested) > in Alfresco using: > doc = repo.createDocument(remoteFile, props, folder, localFile, > properties['contentType'], None) > Now, small files work, but any file larger than 2M fails. > Uploading the same file using CMIS Workbench works fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-961) Connection reset by peer when trying to upload a document over 2M to Alfresco 5.0.d
[ https://issues.apache.org/jira/browse/CMIS-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15297968#comment-15297968 ] Laurent Mignon commented on CMIS-961: - Thank you. I've the feeling that the problem comes from the lack of support for chunked transfer in the native python lib. The python `requests` has special handler for this kind of request. https://github.com/kennethreitz/requests/blob/master/requests/adapters.py#L392 > Connection reset by peer when trying to upload a document over 2M to Alfresco > 5.0.d > --- > > Key: CMIS-961 > URL: https://issues.apache.org/jira/browse/CMIS-961 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Affects Versions: cmislib 0.5.1 > Environment: Alfresco 5.0.d community edition on an Ubuntu 14.04 LTS > based system. >Reporter: Willem Ligtenberg >Assignee: Jeff Potts > Attachments: Sample-Bigish.pdf, Sample-Smallish.pdf > > > Using Alfresco 5.0.a I was able to store large data files (up to 250M tested) > in Alfresco using: > doc = repo.createDocument(remoteFile, props, folder, localFile, > properties['contentType'], None) > Now, small files work, but any file larger than 2M fails. > Uploading the same file using CMIS Workbench works fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (CMIS-993) String concatenation error when specifying custom headers with BrowserBindin
Laurent Mignon created CMIS-993: --- Summary: String concatenation error when specifying custom headers with BrowserBindin Key: CMIS-993 URL: https://issues.apache.org/jira/browse/CMIS-993 Project: Chemistry Issue Type: Bug Components: python-cmislib Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev Reporter: Laurent Mignon -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-993) String concatenation error when specifying custom headers with BrowserBinding
[ https://issues.apache.org/jira/browse/CMIS-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-993: Summary: String concatenation error when specifying custom headers with BrowserBinding (was: String concatenation error when specifying custom headers with BrowserBindin) > String concatenation error when specifying custom headers with BrowserBinding > - > > Key: CMIS-993 > URL: https://issues.apache.org/jira/browse/CMIS-993 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev >Reporter: Laurent Mignon > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-993) String concatenation error when specifying custom headers with BrowserBinding
[ https://issues.apache.org/jira/browse/CMIS-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-993: Description: https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified > String concatenation error when specifying custom headers with BrowserBinding > - > > Key: CMIS-993 > URL: https://issues.apache.org/jira/browse/CMIS-993 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev >Reporter: Laurent Mignon > > https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-993) String concatenation error when specifying custom headers with BrowserBinding
[ https://issues.apache.org/jira/browse/CMIS-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-993: Description: {code} diff --git a/src/cmislib/net.py b/src/cmislib/net.py index 59b3038..9a3db18 100644 --- a/src/cmislib/net.py +++ b/src/cmislib/net.py @@ -51,7 +51,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -74,7 +74,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -107,7 +107,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -141,7 +141,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s' % headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: {code} https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified was: https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified > String concatenation error when specifying custom headers with BrowserBinding > - > > Key: CMIS-993 > URL: https://issues.apache.org/jira/browse/CMIS-993 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev >Reporter: Laurent Mignon > > {code} > diff --git a/src/cmislib/net.py b/src/cmislib/net.py > index 59b3038..9a3db18 100644 > --- a/src/cmislib/net.py > +++ b/src/cmislib/net.py > @@ -51,7 +51,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -74,7 +74,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -107,7 +107,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -141,7 +141,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s' % headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > {code} > https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15457860#comment-15457860 ] Laurent Mignon commented on CMIS-979: - [~jpotts] Thank you! Do you plan to create a git repository dedicated to the cmislib to ease the contribution? I keep mine in synch with svn but It would be nice that the official one was based on git. > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon >Assignee: Jeff Potts > > The browser binding on the trunk doesn't support multi valued values for > properties. > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index b340eda..8565be0 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -352,13 +352,7 @@ class BrowserCmisObject(object): > updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + > self.id > > props = {"cmisaction": "update"} > - > -propCount = 0 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > - > +setProps(properties, props, initialIndex=0) > # invoke the URL > result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), > urlencode(props), > @@ -1325,14 +1319,11 @@ class BrowserRepository(object): > props["propertyId[1]"] = "cmis:objectTypeId" > if properties.has_key('cmis:objectTypeId'): > props["propertyValue[1]"] = properties['cmis:objectTypeId'] > +del properties['cmis:objectTypeId'] > else: > props["propertyValue[1]"] = "cmis:document" > > -propCount = 2 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): > props.update(kwargs) > propCount = 0 > properties = properties or {} > -for key, value in properties.iteritems(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = value > -propCount += 1 > +setProps(properties, props, initialIndex=0) > > ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): > else: > props["propertyValue[1]"] = "cmis:folder" > > -propCount = 2 > -for key, val in properties.items(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = val > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > # invoke the URL > result = > self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), > @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): > pass > > > +def setProps(properties, props, initialIndex=0): > +""" > +Transform key, value from properties into props list items in the format > +expected by the HTTP POST request > +""" > +i = initialIndex > +for key, val in properties.items(): > +props["propertyId[%s]" % i] = key > +if hasattr(val, '__iter__'): > +j = 0 > +for v in val: > +props["propertyValue[%s][%s]" % (i, j)] = v > +j += 1 > +else: > +props["propertyValue[%s]" % i] = val > +i += 1 > + > + > def getSpecializedObject(obj, **kwargs): > > """ > {code} > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (CMIS-995) UnicodeEncodeError when calling urlencode method with a dict that contains accented characters
Laurent Mignon created CMIS-995: --- Summary: UnicodeEncodeError when calling urlencode method with a dict that contains accented characters Key: CMIS-995 URL: https://issues.apache.org/jira/browse/CMIS-995 Project: Chemistry Issue Type: Bug Components: python-cmislib Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev Reporter: Laurent Mignon Assignee: Jeff Potts {code} diff --git a/src/cmislib/net.py b/src/cmislib/net.py index 59b3038..9a3db18 100644 --- a/src/cmislib/net.py +++ b/src/cmislib/net.py @@ -51,7 +51,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -74,7 +74,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -107,7 +107,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s', headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: @@ -141,7 +141,7 @@ class RESTService(object): if 'headers' in kwargs: headers = kwargs['headers'] del kwargs['headers'] -self.logger.debug('Headers passed in:' + headers) +self.logger.debug('Headers passed in: %s' % headers) if url.find('?') >= 0: url = url + '&' + urlencode(kwargs) else: {code} https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-995) UnicodeEncodeError when calling urlencode method with a dict that contains accented characters
[ https://issues.apache.org/jira/browse/CMIS-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-995: Description: {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 800223c..0371cba 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -364,7 +364,7 @@ class BrowserCmisObject(object): # invoke the URL result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password) @@ -393,7 +393,7 @@ class BrowserCmisObject(object): # invoke the URL self._cmisClient.binding.post(moveUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password) @@ -421,7 +421,7 @@ class BrowserCmisObject(object): # invoke the URL self._cmisClient.binding.post(delUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password, @@ -1655,7 +1655,7 @@ class BrowserDocument(BrowserCmisObject): # invoke the URL result = self._cmisClient.binding.post(coUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password) @@ -1682,7 +1682,7 @@ class BrowserDocument(BrowserCmisObject): # invoke the URL self._cmisClient.binding.post(coUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password) @@ -1933,7 +1933,7 @@ class BrowserDocument(BrowserCmisObject): # invoke the URL self._cmisClient.binding.post(delUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password) @@ -2051,7 +2051,7 @@ class BrowserFolder(BrowserCmisObject): # invoke the URL result = self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password, @@ -2269,7 +2269,7 @@ class BrowserFolder(BrowserCmisObject): # invoke the URL self._cmisClient.binding.post(delUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password, @@ -2309,7 +2309,7 @@ class BrowserFolder(BrowserCmisObject): # invoke the URL result = self._cmisClient.binding.post(addUrl.encode('utf-8'), - urlencode(props), + safe_urlencode(props), 'application/x-www-form-urlencoded', self._cmisClient.username, self._cmisClient.password, @@ -2332,7 +2332,7 @@ class BrowserFolder(BrowserCmisObject):
[jira] [Commented] (CMIS-993) String concatenation error when specifying custom headers with BrowserBinding
[ https://issues.apache.org/jira/browse/CMIS-993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15457910#comment-15457910 ] Laurent Mignon commented on CMIS-993: - [~jpotts] Thank you! > String concatenation error when specifying custom headers with BrowserBinding > - > > Key: CMIS-993 > URL: https://issues.apache.org/jira/browse/CMIS-993 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev >Reporter: Laurent Mignon >Assignee: Jeff Potts > > {code} > diff --git a/src/cmislib/net.py b/src/cmislib/net.py > index 59b3038..9a3db18 100644 > --- a/src/cmislib/net.py > +++ b/src/cmislib/net.py > @@ -51,7 +51,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -74,7 +74,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -107,7 +107,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -141,7 +141,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s' % headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > {code} > https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (CMIS-993) String concatenation error when specifying custom headers with BrowserBinding
[ https://issues.apache.org/jira/browse/CMIS-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon closed CMIS-993. --- > String concatenation error when specifying custom headers with BrowserBinding > - > > Key: CMIS-993 > URL: https://issues.apache.org/jira/browse/CMIS-993 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib > Environment: Linux, python 2.7x, Alfresco 5.0.x, cmislib dev >Reporter: Laurent Mignon >Assignee: Jeff Potts > > {code} > diff --git a/src/cmislib/net.py b/src/cmislib/net.py > index 59b3038..9a3db18 100644 > --- a/src/cmislib/net.py > +++ b/src/cmislib/net.py > @@ -51,7 +51,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -74,7 +74,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -107,7 +107,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s', headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > @@ -141,7 +141,7 @@ class RESTService(object): > if 'headers' in kwargs: > headers = kwargs['headers'] > del kwargs['headers'] > -self.logger.debug('Headers passed in:' + headers) > +self.logger.debug('Headers passed in: %s' % headers) > if url.find('?') >= 0: > url = url + '&' + urlencode(kwargs) > else: > {code} > https://github.com/lmignon/python-cmislib/commit/159f0202d7dd012230b31a42ef13ef0d03b46f96?diff=unified -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon closed CMIS-979. --- > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon >Assignee: Jeff Potts > > The browser binding on the trunk doesn't support multi valued values for > properties. > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index b340eda..8565be0 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -352,13 +352,7 @@ class BrowserCmisObject(object): > updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + > self.id > > props = {"cmisaction": "update"} > - > -propCount = 0 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > - > +setProps(properties, props, initialIndex=0) > # invoke the URL > result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), > urlencode(props), > @@ -1325,14 +1319,11 @@ class BrowserRepository(object): > props["propertyId[1]"] = "cmis:objectTypeId" > if properties.has_key('cmis:objectTypeId'): > props["propertyValue[1]"] = properties['cmis:objectTypeId'] > +del properties['cmis:objectTypeId'] > else: > props["propertyValue[1]"] = "cmis:document" > > -propCount = 2 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): > props.update(kwargs) > propCount = 0 > properties = properties or {} > -for key, value in properties.iteritems(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = value > -propCount += 1 > +setProps(properties, props, initialIndex=0) > > ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): > else: > props["propertyValue[1]"] = "cmis:folder" > > -propCount = 2 > -for key, val in properties.items(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = val > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > # invoke the URL > result = > self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), > @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): > pass > > > +def setProps(properties, props, initialIndex=0): > +""" > +Transform key, value from properties into props list items in the format > +expected by the HTTP POST request > +""" > +i = initialIndex > +for key, val in properties.items(): > +props["propertyId[%s]" % i] = key > +if hasattr(val, '__iter__'): > +j = 0 > +for v in val: > +props["propertyValue[%s][%s]" % (i, j)] = v > +j += 1 > +else: > +props["propertyValue[%s]" % i] = val > +i += 1 > + > + > def getSpecializedObject(obj, **kwargs): > > """ > {code} > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-979) Allow to use multi valued values in properties when using the Browser Binding
[ https://issues.apache.org/jira/browse/CMIS-979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15477345#comment-15477345 ] Laurent Mignon commented on CMIS-979: - [~gagravarr] Thank you for the answer. The last time I've looked to the github repository it seemed to be un synced with svn. Am I wrong? Regards > Allow to use multi valued values in properties when using the Browser Binding > - > > Key: CMIS-979 > URL: https://issues.apache.org/jira/browse/CMIS-979 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon >Assignee: Jeff Potts > > The browser binding on the trunk doesn't support multi valued values for > properties. > {code} > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index b340eda..8565be0 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -352,13 +352,7 @@ class BrowserCmisObject(object): > updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + > self.id > > props = {"cmisaction": "update"} > - > -propCount = 0 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > - > +setProps(properties, props, initialIndex=0) > # invoke the URL > result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), > urlencode(props), > @@ -1325,14 +1319,11 @@ class BrowserRepository(object): > props["propertyId[1]"] = "cmis:objectTypeId" > if properties.has_key('cmis:objectTypeId'): > props["propertyValue[1]"] = properties['cmis:objectTypeId'] > +del properties['cmis:objectTypeId'] > else: > props["propertyValue[1]"] = "cmis:document" > > -propCount = 2 > -for prop in properties: > -props["propertyId[%s]" % propCount] = prop > -props["propertyValue[%s]" % propCount] = properties[prop] > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > contentType, body = encode_multipart_formdata(props, contentFile, > contentType) > > @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): > props.update(kwargs) > propCount = 0 > properties = properties or {} > -for key, value in properties.iteritems(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = value > -propCount += 1 > +setProps(properties, props, initialIndex=0) > > ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id > + "&cmisaction=checkin" > > @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): > else: > props["propertyValue[1]"] = "cmis:folder" > > -propCount = 2 > -for key, val in properties.items(): > -props["propertyId[%s]" % propCount] = key > -props["propertyValue[%s]" % propCount] = val > -propCount += 1 > +setProps(properties, props, initialIndex=2) > > # invoke the URL > result = > self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), > @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): > pass > > > +def setProps(properties, props, initialIndex=0): > +""" > +Transform key, value from properties into props list items in the format > +expected by the HTTP POST request > +""" > +i = initialIndex > +for key, val in properties.items(): > +props["propertyId[%s]" % i] = key > +if hasattr(val, '__iter__'): > +j = 0 > +for v in val: > +props["propertyValue[%s][%s]" % (i, j)] = v > +j += 1 > +else: > +props["propertyValue[%s]" % i] = val > +i += 1 > + > + > def getSpecializedObject(obj, **kwargs): > > """ > {code} > https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
Laurent Mignon created CMIS-996: --- Summary: BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote Key: CMIS-996 URL: https://issues.apache.org/jira/browse/CMIS-996 Project: Chemistry Issue Type: Bug Components: python-cmislib Reporter: Laurent Mignon Assignee: Jeff Potts The browser binding on the trunk doesn't support multi valued values for properties. {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index b340eda..8565be0 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -352,13 +352,7 @@ class BrowserCmisObject(object): updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id props = {"cmisaction": "update"} - -propCount = 0 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 - +setProps(properties, props, initialIndex=0) # invoke the URL result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), urlencode(props), @@ -1325,14 +1319,11 @@ class BrowserRepository(object): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:document" -propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 +setProps(properties, props, initialIndex=2) contentType, body = encode_multipart_formdata(props, contentFile, contentType) @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): props.update(kwargs) propCount = 0 properties = properties or {} -for key, value in properties.iteritems(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = value -propCount += 1 +setProps(properties, props, initialIndex=0) ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): else: props["propertyValue[1]"] = "cmis:folder" -propCount = 2 -for key, val in properties.items(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = val -propCount += 1 +setProps(properties, props, initialIndex=2) # invoke the URL result = self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): pass +def setProps(properties, props, initialIndex=0): +""" +Transform key, value from properties into props list items in the format +expected by the HTTP POST request +""" +i = initialIndex +for key, val in properties.items(): +props["propertyId[%s]" % i] = key +if hasattr(val, '__iter__'): +j = 0 +for v in val: +props["propertyValue[%s][%s]" % (i, j)] = v +j += 1 +else: +props["propertyValue[%s]" % i] = val +i += 1 + + def getSpecializedObject(obj, **kwargs): """ {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
[ https://issues.apache.org/jira/browse/CMIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-996: Description: The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. A patch will follow. (was: The browser binding on the trunk doesn't support multi valued values for properties. {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index b340eda..8565be0 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -352,13 +352,7 @@ class BrowserCmisObject(object): updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id props = {"cmisaction": "update"} - -propCount = 0 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 - +setProps(properties, props, initialIndex=0) # invoke the URL result = self._cmisClient.binding.post(updateUrl.encode('utf-8'), urlencode(props), @@ -1325,14 +1319,11 @@ class BrowserRepository(object): props["propertyId[1]"] = "cmis:objectTypeId" if properties.has_key('cmis:objectTypeId'): props["propertyValue[1]"] = properties['cmis:objectTypeId'] +del properties['cmis:objectTypeId'] else: props["propertyValue[1]"] = "cmis:document" -propCount = 2 -for prop in properties: -props["propertyId[%s]" % propCount] = prop -props["propertyValue[%s]" % propCount] = properties[prop] -propCount += 1 +setProps(properties, props, initialIndex=2) contentType, body = encode_multipart_formdata(props, contentFile, contentType) @@ -1775,10 +1766,7 @@ class BrowserDocument(BrowserCmisObject): props.update(kwargs) propCount = 0 properties = properties or {} -for key, value in properties.iteritems(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = value -propCount += 1 +setProps(properties, props, initialIndex=0) ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" @@ -2050,11 +2038,7 @@ class BrowserFolder(BrowserCmisObject): else: props["propertyValue[1]"] = "cmis:folder" -propCount = 2 -for key, val in properties.items(): -props["propertyId[%s]" % propCount] = key -props["propertyValue[%s]" % propCount] = val -propCount += 1 +setProps(properties, props, initialIndex=2) # invoke the URL result = self._cmisClient.binding.post(createFolderUrl.encode('utf-8'), @@ -3028,6 +3012,24 @@ class BrowserCmisId(str): pass +def setProps(properties, props, initialIndex=0): +""" +Transform key, value from properties into props list items in the format +expected by the HTTP POST request +""" +i = initialIndex +for key, val in properties.items(): +props["propertyId[%s]" % i] = key +if hasattr(val, '__iter__'): +j = 0 +for v in val: +props["propertyValue[%s][%s]" % (i, j)] = v +j += 1 +else: +props["propertyValue[%s]" % i] = val +i += 1 + + def getSpecializedObject(obj, **kwargs): """ {code} https://github.com/lmignon/python-cmislib/commit/04c944398531691b86c39cf3160cd61c1553a137) > BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote > > > Key: CMIS-996 > URL: https://issues.apache.org/jira/browse/CMIS-996 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Laurent Mignon >Assignee: Jeff Potts > > The function getObjectByPath use urllib.quote to quote the path into the url. > urllib.quote doesn't support unicode values. A patch will follow. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
[ https://issues.apache.org/jira/browse/CMIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-996: Description: The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. see https://github.com/apache/chemistry-cmislib/pull/4 {code} diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..fa20281 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -715,7 +715,7 @@ class BrowserRepository(object): - includeAllowableActions """ -byPathUrl = self.getRootFolderUrl() + quote(path) + "?cmisselector=object" +byPathUrl = self.getRootFolderUrl() + safe_quote(path) + "?cmisselector=object" result = self._cmisClient.binding.get(byPathUrl.encode('utf-8'), self._cmisClient.username, self._cmisClient.password, @@ -926,7 +926,7 @@ class BrowserRepository(object): typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) result = self._cmisClient.binding.get(typesUrl, self._cmisClient.username, @@ -986,7 +986,7 @@ class BrowserRepository(object): typesUrl = self.getRepositoryUrl() + "?cmisselector=typeDescendants" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) if depth is not None: typesUrl += "&depth=%s" % (depth) print typesUrl @@ -1180,7 +1180,7 @@ class BrowserRepository(object): """ # build the CMIS query XML that we're going to POST -queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + quote(statement) +queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + safe_quote(statement) # do the POST result = self._cmisClient.binding.post(queryUrl.encode('utf-8'), @@ -3182,6 +3182,21 @@ def safe_urlencode(in_dict): return urlencode(encoded_dict(in_dict)) +def safe_quote(value): + +""" +Safe encoding of value taking care of unicode value +urllib.quote doesn't like unicode values +""" + +if isinstance(value, unicode): +value = value.encode('utf8') +elif isinstance(value, str): +# Must be encoded in UTF-8 +value.decode('utf8') +return quote(value) + + class ResultsSerializer(object): """ diff --git a/src/tests/cmislibtest.py b/src/tests/cmislibtest.py index a81be56..2ec128d 100644 --- a/src/tests/cmislibtest.py +++ b/src/tests/cmislibtest.py @@ -374,6 +374,38 @@ class RepositoryTest(CmisTestBase): subFolder = self._repo.getObjectByPath(subFolderPath) self.assertEquals(len(subFolder.getChildren().getResults()), 1) +def testGetObjectByPathUnicode(self): +"""Create test objects (one folder, one document) then try to get +them by path""" +# names of folders and test docs +parentFolderName = 'testGetObjectByPath folder' +subFolderName = u'subfolder_éà' +docName = u'testdoc_éà' + +# create the folder structure +parentFolder = self._testFolder.createFolder(parentFolderName) +subFolder = parentFolder.createFolder(subFolderName) +# use the subfolder path to get the folder by path +subFolderPath = subFolder.getProperties().get("cmis:path") +searchFolder = self._repo.getObjectByPath(subFolderPath) +self.assertEquals(subFolder.getObjectId(), searchFolder.getObjectId()) + +# create a test doc +doc = subFolder.createDocument(docName) +# ask the doc for its paths +searchDocPaths = doc.getPaths() +# for each path in the list, try to get the object by path +# this is better than building a path with the doc's name b/c the name +# isn't guaranteed to be used as the path segment (see CMIS-232) +for path in searchDocPaths: +searchDoc = self._repo.getObjectByPath(path) +self.assertEquals(doc.getObjectId(), searchDoc.getObjectId()) + +# get the subfolder by path, then ask for its children +subFolder = self._repo.getObjectByPath(subFolderPath) +self.assertEquals(len(subFolder.getChildren().getResults()), 1) + + # getting unfiled documents may work for the atom pub binding for some servers # but it isn't part of the spec so removing this test for now ''' {code} was:The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. A patch will follow. > BrowserBinding
[jira] [Updated] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-972: Description: I've improved the checkin method to allow to update the content stream and the properties {code} >From cbca562e4cfce685c2cc60ee2ad0d73182d3cb5f Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 18:53:05 +0200 Subject: [PATCH] Support content and properties paramaters on method checkin --- src/cmislib/atompub/binding.py | 23 --- src/cmislib/browser/binding.py | 34 -- src/cmislib/domain.py | 9 +++-- src/tests/cmislibtest.py | 42 ++ 4 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..2eee222 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -2362,7 +2362,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -2378,10 +2379,7 @@ def checkin(self, checkinComment=None, **kwargs): >>> doc.isCheckedOut() False -The following optional arguments are supported: - - major - - properties - - contentStream +The following optional arguments are NOT supported: - policies - addACEs - removeACEs @@ -2395,8 +2393,19 @@ def checkin(self, checkinComment=None, **kwargs): kwargs['checkin'] = 'true' kwargs['checkinComment'] = checkinComment -# Build an empty ATOM entry -entryXmlDoc = getEmptyXmlDoc() +if not properties and not contentFile: +# Build an empty ATOM entry +entryXmlDoc = getEmptyXmlDoc() +else: +# the getEntryXmlDoc function may need the object type +objectTypeId = None +if self.properties.has_key('cmis:objectTypeId') and not properties.has_key('cmis:objectTypeId'): +objectTypeId = self.properties['cmis:objectTypeId'] +self.logger.debug('This object type is:%s', objectTypeId) + +# build the entry based on the properties provided +entryXmlDoc = getEntryXmlDoc( +self._repository, objectTypeId, properties, contentFile, contentType) # Get the self link # Do a PUT of the empty ATOM to the self link diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..c300e5e 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1755,7 +1755,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -1772,9 +1773,6 @@ def checkin(self, checkinComment=None, **kwargs): False The following optional arguments are NOT supported: - - major - - properties - - contentStream - policies - addACEs - removeACEs @@ -1784,21 +1782,29 @@ def checkin(self, checkinComment=None, **kwargs): if not kwargs.has_key('major'): kwargs['major'] = 'true' -kwargs['checkinComment'] = checkinComment - -ciUrl = self._repository.getRootFolderUrl() +else: +kwargs['major'] = 'false' +props = { +'checkinComment': checkinComment or "", +} +props.update(kwargs) +propCount = 0 +properties = properties or {} +for key, value in properties.iteritems(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = value +propCount += 1 + +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" -# TODO don't hardcode major flag -props = {"objectId": self.id, - "cmisaction": "checkIn"} +contentType, body = encode_multipart_formdata(props, contentFile, contentType) # invoke the URL result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), - safe_urlencode(props), - 'application/x-www-form-urlencoded', + body
[jira] [Commented] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15479556#comment-15479556 ] Laurent Mignon commented on CMIS-972: - [~jpotts] I've implemented the improvement for the 2 bindings. AtomPub binding and the Browser binding stay interchangeable. I've also added a test to cover this change. Regads, lmi > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > From cbca562e4cfce685c2cc60ee2ad0d73182d3cb5f Mon Sep 17 00:00:00 2001 > From: Laurent Mignon > Date: Fri, 9 Sep 2016 18:53:05 +0200 > Subject: [PATCH] Support content and properties paramaters on method checkin > --- > src/cmislib/atompub/binding.py | 23 --- > src/cmislib/browser/binding.py | 34 -- > src/cmislib/domain.py | 9 +++-- > src/tests/cmislibtest.py | 42 > ++ > 4 files changed, 81 insertions(+), 27 deletions(-) > diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py > index f1a629f..2eee222 100644 > --- a/src/cmislib/atompub/binding.py > +++ b/src/cmislib/atompub/binding.py > @@ -2362,7 +2362,8 @@ def getCheckedOutBy(self): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None, > +properties=None, **kwargs): > > """ > Checks in this :class:`Document` which must be a private > @@ -2378,10 +2379,7 @@ def checkin(self, checkinComment=None, **kwargs): > >>> doc.isCheckedOut() > False > > -The following optional arguments are supported: > - - major > - - properties > - - contentStream > +The following optional arguments are NOT supported: > - policies > - addACEs > - removeACEs > @@ -2395,8 +2393,19 @@ def checkin(self, checkinComment=None, **kwargs): > kwargs['checkin'] = 'true' > kwargs['checkinComment'] = checkinComment > > -# Build an empty ATOM entry > -entryXmlDoc = getEmptyXmlDoc() > +if not properties and not contentFile: > +# Build an empty ATOM entry > +entryXmlDoc = getEmptyXmlDoc() > +else: > +# the getEntryXmlDoc function may need the object type > +objectTypeId = None > +if self.properties.has_key('cmis:objectTypeId') and not > properties.has_key('cmis:objectTypeId'): > +objectTypeId = self.properties['cmis:objectTypeId'] > +self.logger.debug('This object type is:%s', objectTypeId) > + > +# build the entry based on the properties provided > +entryXmlDoc = getEntryXmlDoc( > +self._repository, objectTypeId, properties, contentFile, > contentType) > > # Get the self link > # Do a PUT of the empty ATOM to the self link > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index 7d7d758..c300e5e 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1755,7 +1755,8 @@ def getCheckedOutBy(self): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None, > +properties=None, **kwargs): > > """ > Checks in this :class:`Document` which must be a private > @@ -1772,9 +1773,6 @@ def checkin(self, checkinComment=None, **kwargs): > False > > The following optional arguments are NOT supported: > - - major > - - properties > - - contentStream > - policies > - addACEs > - removeACEs > @@ -1784,21 +1782,29 @@ def checkin(self, checkinComment=None, **kwargs): > if not kwargs.has_key('major'): > kwargs['major'] = 'true' > > -kwargs['checkinComment'] = checkinComment > - > -ciUrl = self._repository.getRootFolderUrl() > +else: > +kwargs['major'] = 'false' > +props = { > +'checkinComment': checkinComme
[jira] [Comment Edited] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method
[ https://issues.apache.org/jira/browse/CMIS-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15479556#comment-15479556 ] Laurent Mignon edited comment on CMIS-972 at 9/10/16 10:12 AM: --- [~jpotts] I've implemented the improvement for the 2 bindings. AtomPub binding and the Browser binding stay interchangeable. I've also added a test to cover this change. Regads, lmi PR https://github.com/apache/chemistry-cmislib/pull/5 was (Author: lmi): [~jpotts] I've implemented the improvement for the 2 bindings. AtomPub binding and the Browser binding stay interchangeable. I've also added a test to cover this change. Regads, lmi > Implement contentStream and properties update in BrowserDocument.checkin > method > --- > > Key: CMIS-972 > URL: https://issues.apache.org/jira/browse/CMIS-972 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > > I've improved the checkin method to allow to update the content stream and > the properties > {code} > From cbca562e4cfce685c2cc60ee2ad0d73182d3cb5f Mon Sep 17 00:00:00 2001 > From: Laurent Mignon > Date: Fri, 9 Sep 2016 18:53:05 +0200 > Subject: [PATCH] Support content and properties paramaters on method checkin > --- > src/cmislib/atompub/binding.py | 23 --- > src/cmislib/browser/binding.py | 34 -- > src/cmislib/domain.py | 9 +++-- > src/tests/cmislibtest.py | 42 > ++ > 4 files changed, 81 insertions(+), 27 deletions(-) > diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py > index f1a629f..2eee222 100644 > --- a/src/cmislib/atompub/binding.py > +++ b/src/cmislib/atompub/binding.py > @@ -2362,7 +2362,8 @@ def getCheckedOutBy(self): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None, > +properties=None, **kwargs): > > """ > Checks in this :class:`Document` which must be a private > @@ -2378,10 +2379,7 @@ def checkin(self, checkinComment=None, **kwargs): > >>> doc.isCheckedOut() > False > > -The following optional arguments are supported: > - - major > - - properties > - - contentStream > +The following optional arguments are NOT supported: > - policies > - addACEs > - removeACEs > @@ -2395,8 +2393,19 @@ def checkin(self, checkinComment=None, **kwargs): > kwargs['checkin'] = 'true' > kwargs['checkinComment'] = checkinComment > > -# Build an empty ATOM entry > -entryXmlDoc = getEmptyXmlDoc() > +if not properties and not contentFile: > +# Build an empty ATOM entry > +entryXmlDoc = getEmptyXmlDoc() > +else: > +# the getEntryXmlDoc function may need the object type > +objectTypeId = None > +if self.properties.has_key('cmis:objectTypeId') and not > properties.has_key('cmis:objectTypeId'): > +objectTypeId = self.properties['cmis:objectTypeId'] > +self.logger.debug('This object type is:%s', objectTypeId) > + > +# build the entry based on the properties provided > +entryXmlDoc = getEntryXmlDoc( > +self._repository, objectTypeId, properties, contentFile, > contentType) > > # Get the self link > # Do a PUT of the empty ATOM to the self link > diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py > index 7d7d758..c300e5e 100644 > --- a/src/cmislib/browser/binding.py > +++ b/src/cmislib/browser/binding.py > @@ -1755,7 +1755,8 @@ def getCheckedOutBy(self): > self.reload() > return self.getProperties()['cmis:versionSeriesCheckedOutBy'] > > -def checkin(self, checkinComment=None, **kwargs): > +def checkin(self, checkinComment=None, contentFile=None, > contentType=None, > +properties=None, **kwargs): > > """ > Checks in this :class:`Document` which must be a private > @@ -1772,9 +1773,6 @@ def checkin(self, checkinComment=None, **kwargs): > False > > The following optional arguments are NOT supported: > - - major > - - properties > - - contentStream > - policies > - addACEs > - removeACEs > @@ -1784,21 +1782,29 @@ def checkin(self, checkinComment=None, **kwargs): > if
[jira] [Updated] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
[ https://issues.apache.org/jira/browse/CMIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-996: Description: The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. see https://github.com/apache/chemistry-cmislib/pull/4 {code} >From 144475d56aa4a8547f8c5a869f75697e6f653d99 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 19:52:30 +0200 Subject: [PATCH] Fix UnicodeEncodeError when calling urllib.quote whith value containing accented chars In the same time ensure that all the sources files are in the same encoding as python itself (utf-8) by adding an encoding declaration at first line of any files. --- src/cmislib/atompub/binding.py | 1 + src/cmislib/browser/binding.py | 38 ++ src/cmislib/cmis_services.py | 1 + src/cmislib/domain.py | 1 + src/cmislib/exceptions.py | 1 + src/cmislib/messages.py| 1 + src/cmislib/model.py | 1 + src/cmislib/net.py | 1 + src/cmislib/util.py| 1 + src/tests/cmislibtest.py | 53 +- 10 files changed, 63 insertions(+), 36 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..55a066a 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..c148a0c 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -715,7 +716,7 @@ def getObjectByPath(self, path, **kwargs): - includeAllowableActions """ -byPathUrl = self.getRootFolderUrl() + quote(path) + "?cmisselector=object" +byPathUrl = self.getRootFolderUrl() + safe_quote(path) + "?cmisselector=object" result = self._cmisClient.binding.get(byPathUrl.encode('utf-8'), self._cmisClient.username, self._cmisClient.password, @@ -926,7 +927,7 @@ def getTypeChildren(self, typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) result = self._cmisClient.binding.get(typesUrl, self._cmisClient.username, @@ -986,7 +987,7 @@ def getTypeDescendants(self, typeId=None, depth=None, **kwargs): typesUrl = self.getRepositoryUrl() + "?cmisselector=typeDescendants" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) if depth is not None: typesUrl += "&depth=%s" % (depth) print typesUrl @@ -1180,7 +1181,7 @@ def query(self, statement, **kwargs): """ # build the CMIS query XML that we're going to POST -queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + quote(statement) +queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + safe_quote(statement) # do the POST result = self._cmisClient.binding.post(queryUrl.encode('utf-8'), @@ -3161,6 +3162,18 @@ def encode_multipart_formdata(fields, contentFile, contentType): return content_type, body +def to_utf8(value): + +""" Safe encodng of value to utf-8 taking care of unicode values +""" +if isinstance(value, unicode): +value = value.encode('utf8') +elif isinstance(value, str): +# Must be encoded in UTF-8 +value.decode('utf8') +return value + + def safe_urlencode(in_dict): """ @@ -3171,17 +3184,22 @@ def safe_urlencode(in_dict): def encoded_dict(in_dict): out_dict = {} for k, v in in_dict.iteritems(): -if isinstance(v, unicode): -v = v.encode('utf8') -elif isinstance(v, str): -# Must be encoded in UTF-8 -v.decode('utf8') -out_dict[k] = v +out_dict[k] = to_utf8(v) return out_dict return urlencode(encoded_dict(in_dict)) +def safe_quote(value): + +""" +Safe encoding of value taking care of unicode value +urllib.quote doesn't like unicode values +""" + +return quote(to_utf8(value)) + + class ResultsSerializer(object): """ diff --git a/src/cmislib/cm
[jira] [Updated] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
[ https://issues.apache.org/jira/browse/CMIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-996: Description: The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. see https://github.com/apache/chemistry-cmislib/pull/4 {code} >From 26e824b255acb0721516067ffc53093696acb191 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 19:52:30 +0200 Subject: [PATCH] Fix UnicodeEncodeError when calling urllib.quote whith value containing accented chars In the same time ensure that all the sources files are in the same encoding as python itself (utf-8) by adding an encoding declaration at first line of any files. --- src/cmislib/atompub/binding.py | 1 + src/cmislib/browser/binding.py | 38 + src/cmislib/cmis_services.py | 1 + src/cmislib/domain.py | 1 + src/cmislib/exceptions.py | 1 + src/cmislib/messages.py| 1 + src/cmislib/model.py | 1 + src/cmislib/net.py | 1 + src/cmislib/util.py| 1 + src/tests/cmislibtest.py | 55 +- 10 files changed, 64 insertions(+), 37 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..55a066a 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..c148a0c 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -715,7 +716,7 @@ def getObjectByPath(self, path, **kwargs): - includeAllowableActions """ -byPathUrl = self.getRootFolderUrl() + quote(path) + "?cmisselector=object" +byPathUrl = self.getRootFolderUrl() + safe_quote(path) + "?cmisselector=object" result = self._cmisClient.binding.get(byPathUrl.encode('utf-8'), self._cmisClient.username, self._cmisClient.password, @@ -926,7 +927,7 @@ def getTypeChildren(self, typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) result = self._cmisClient.binding.get(typesUrl, self._cmisClient.username, @@ -986,7 +987,7 @@ def getTypeDescendants(self, typeId=None, depth=None, **kwargs): typesUrl = self.getRepositoryUrl() + "?cmisselector=typeDescendants" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) if depth is not None: typesUrl += "&depth=%s" % (depth) print typesUrl @@ -1180,7 +1181,7 @@ def query(self, statement, **kwargs): """ # build the CMIS query XML that we're going to POST -queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + quote(statement) +queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + safe_quote(statement) # do the POST result = self._cmisClient.binding.post(queryUrl.encode('utf-8'), @@ -3161,6 +3162,18 @@ def encode_multipart_formdata(fields, contentFile, contentType): return content_type, body +def to_utf8(value): + +""" Safe encodng of value to utf-8 taking care of unicode values +""" +if isinstance(value, unicode): +value = value.encode('utf8') +elif isinstance(value, str): +# Must be encoded in UTF-8 +value.decode('utf8') +return value + + def safe_urlencode(in_dict): """ @@ -3171,17 +3184,22 @@ def safe_urlencode(in_dict): def encoded_dict(in_dict): out_dict = {} for k, v in in_dict.iteritems(): -if isinstance(v, unicode): -v = v.encode('utf8') -elif isinstance(v, str): -# Must be encoded in UTF-8 -v.decode('utf8') -out_dict[k] = v +out_dict[k] = to_utf8(v) return out_dict return urlencode(encoded_dict(in_dict)) +def safe_quote(value): + +""" +Safe encoding of value taking care of unicode value +urllib.quote doesn't like unicode values +""" + +return quote(to_utf8(value)) + + class ResultsSerializer(object): """ diff --git a/src/cmislib/cmi
[jira] [Updated] (CMIS-996) BrowserBinding getObjecyByPath: unicode is not supported by urllib.quote
[ https://issues.apache.org/jira/browse/CMIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-996: Description: The function getObjectByPath use urllib.quote to quote the path into the url. urllib.quote doesn't support unicode values. see https://github.com/apache/chemistry-cmislib/pull/4 patch code from see https://github.com/apache/chemistry-cmislib/pull/4.patch {code} >From f0276c81ef55b6e16a2cbe096870049f0d578747 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 19:52:30 +0200 Subject: [PATCH] Fix UnicodeEncodeError when calling urllib.quote whith value containing accented chars In the same time ensure that all the sources files are in the same encoding as python itself (utf-8) by adding an encoding declaration at first line of any files. --- src/cmislib/atompub/binding.py | 1 + src/cmislib/browser/binding.py | 35 +++ src/cmislib/cmis_services.py | 1 + src/cmislib/domain.py | 1 + src/cmislib/exceptions.py | 1 + src/cmislib/messages.py| 1 + src/cmislib/model.py | 1 + src/cmislib/net.py | 1 + src/cmislib/util.py| 1 + src/tests/cmislibtest.py | 55 +- 10 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..55a066a 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..45b6aa6 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -715,7 +716,7 @@ def getObjectByPath(self, path, **kwargs): - includeAllowableActions """ -byPathUrl = self.getRootFolderUrl() + quote(path) + "?cmisselector=object" +byPathUrl = self.getRootFolderUrl() + safe_quote(path) + "?cmisselector=object" result = self._cmisClient.binding.get(byPathUrl.encode('utf-8'), self._cmisClient.username, self._cmisClient.password, @@ -926,7 +927,7 @@ def getTypeChildren(self, typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) result = self._cmisClient.binding.get(typesUrl, self._cmisClient.username, @@ -986,7 +987,7 @@ def getTypeDescendants(self, typeId=None, depth=None, **kwargs): typesUrl = self.getRepositoryUrl() + "?cmisselector=typeDescendants" if typeId is not None: -typesUrl += "&typeId=%s" % (quote(typeId)) +typesUrl += "&typeId=%s" % (safe_quote(typeId)) if depth is not None: typesUrl += "&depth=%s" % (depth) print typesUrl @@ -1180,7 +1181,7 @@ def query(self, statement, **kwargs): """ # build the CMIS query XML that we're going to POST -queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + quote(statement) +queryUrl = self.getRepositoryUrl() + "?cmisaction=query&q=" + safe_quote(statement) # do the POST result = self._cmisClient.binding.post(queryUrl.encode('utf-8'), @@ -3161,6 +3162,15 @@ def encode_multipart_formdata(fields, contentFile, contentType): return content_type, body +def to_utf8(value): + +""" Safe encodng of value to utf-8 taking care of unicode values +""" +if isinstance(value, unicode): +value = value.encode('utf8') +return value + + def safe_urlencode(in_dict): """ @@ -3171,17 +3181,22 @@ def safe_urlencode(in_dict): def encoded_dict(in_dict): out_dict = {} for k, v in in_dict.iteritems(): -if isinstance(v, unicode): -v = v.encode('utf8') -elif isinstance(v, str): -# Must be encoded in UTF-8 -v.decode('utf8') -out_dict[k] = v +out_dict[k] = to_utf8(v) return out_dict return urlencode(encoded_dict(in_dict)) +def safe_quote(value): + +""" +Safe encoding of value taking care of unicode value +urllib.quote doesn't like unicode values +""" + +return quote(to_utf8(value)) + + class ResultsSerializer(object): """ diff --git a/src/cmislib/cmis_services.py b/src/cmis
[jira] [Created] (CMIS-1002) Allow access to the repository from a CmisObject instance
Laurent Mignon created CMIS-1002: Summary: Allow access to the repository from a CmisObject instance Key: CMIS-1002 URL: https://issues.apache.org/jira/browse/CMIS-1002 Project: Chemistry Issue Type: Improvement Components: python-cmislib Environment: Linux, python 2.7.x, Alfresco 5.0.x Reporter: Laurent Mignon Assignee: Jeff Potts I've improved the checkin method to allow to update the content stream and the properties {code} >From cbca562e4cfce685c2cc60ee2ad0d73182d3cb5f Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 18:53:05 +0200 Subject: [PATCH] Support content and properties paramaters on method checkin --- src/cmislib/atompub/binding.py | 23 --- src/cmislib/browser/binding.py | 34 -- src/cmislib/domain.py | 9 +++-- src/tests/cmislibtest.py | 42 ++ 4 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..2eee222 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -2362,7 +2362,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -2378,10 +2379,7 @@ def checkin(self, checkinComment=None, **kwargs): >>> doc.isCheckedOut() False -The following optional arguments are supported: - - major - - properties - - contentStream +The following optional arguments are NOT supported: - policies - addACEs - removeACEs @@ -2395,8 +2393,19 @@ def checkin(self, checkinComment=None, **kwargs): kwargs['checkin'] = 'true' kwargs['checkinComment'] = checkinComment -# Build an empty ATOM entry -entryXmlDoc = getEmptyXmlDoc() +if not properties and not contentFile: +# Build an empty ATOM entry +entryXmlDoc = getEmptyXmlDoc() +else: +# the getEntryXmlDoc function may need the object type +objectTypeId = None +if self.properties.has_key('cmis:objectTypeId') and not properties.has_key('cmis:objectTypeId'): +objectTypeId = self.properties['cmis:objectTypeId'] +self.logger.debug('This object type is:%s', objectTypeId) + +# build the entry based on the properties provided +entryXmlDoc = getEntryXmlDoc( +self._repository, objectTypeId, properties, contentFile, contentType) # Get the self link # Do a PUT of the empty ATOM to the self link diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..c300e5e 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1755,7 +1755,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -1772,9 +1773,6 @@ def checkin(self, checkinComment=None, **kwargs): False The following optional arguments are NOT supported: - - major - - properties - - contentStream - policies - addACEs - removeACEs @@ -1784,21 +1782,29 @@ def checkin(self, checkinComment=None, **kwargs): if not kwargs.has_key('major'): kwargs['major'] = 'true' -kwargs['checkinComment'] = checkinComment - -ciUrl = self._repository.getRootFolderUrl() +else: +kwargs['major'] = 'false' +props = { +'checkinComment': checkinComment or "", +} +props.update(kwargs) +propCount = 0 +properties = properties or {} +for key, value in properties.iteritems(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = value +propCount += 1 + +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" -# TODO don't hardcode major flag -props = {"objectId": self.id, - "cmisaction": "checkIn"} +contentType, body = encode_multipart_formdata(props, contentFile, contentType) # invoke the URL
[jira] [Updated] (CMIS-1002) Allow access to the repository from a CmisObject instance
[ https://issues.apache.org/jira/browse/CMIS-1002?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-1002: - Description: https://github.com/apache/chemistry-cmislib/pull/6 (was: I've improved the checkin method to allow to update the content stream and the properties {code} >From cbca562e4cfce685c2cc60ee2ad0d73182d3cb5f Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 9 Sep 2016 18:53:05 +0200 Subject: [PATCH] Support content and properties paramaters on method checkin --- src/cmislib/atompub/binding.py | 23 --- src/cmislib/browser/binding.py | 34 -- src/cmislib/domain.py | 9 +++-- src/tests/cmislibtest.py | 42 ++ 4 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/cmislib/atompub/binding.py b/src/cmislib/atompub/binding.py index f1a629f..2eee222 100644 --- a/src/cmislib/atompub/binding.py +++ b/src/cmislib/atompub/binding.py @@ -2362,7 +2362,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -2378,10 +2379,7 @@ def checkin(self, checkinComment=None, **kwargs): >>> doc.isCheckedOut() False -The following optional arguments are supported: - - major - - properties - - contentStream +The following optional arguments are NOT supported: - policies - addACEs - removeACEs @@ -2395,8 +2393,19 @@ def checkin(self, checkinComment=None, **kwargs): kwargs['checkin'] = 'true' kwargs['checkinComment'] = checkinComment -# Build an empty ATOM entry -entryXmlDoc = getEmptyXmlDoc() +if not properties and not contentFile: +# Build an empty ATOM entry +entryXmlDoc = getEmptyXmlDoc() +else: +# the getEntryXmlDoc function may need the object type +objectTypeId = None +if self.properties.has_key('cmis:objectTypeId') and not properties.has_key('cmis:objectTypeId'): +objectTypeId = self.properties['cmis:objectTypeId'] +self.logger.debug('This object type is:%s', objectTypeId) + +# build the entry based on the properties provided +entryXmlDoc = getEntryXmlDoc( +self._repository, objectTypeId, properties, contentFile, contentType) # Get the self link # Do a PUT of the empty ATOM to the self link diff --git a/src/cmislib/browser/binding.py b/src/cmislib/browser/binding.py index 7d7d758..c300e5e 100644 --- a/src/cmislib/browser/binding.py +++ b/src/cmislib/browser/binding.py @@ -1755,7 +1755,8 @@ def getCheckedOutBy(self): self.reload() return self.getProperties()['cmis:versionSeriesCheckedOutBy'] -def checkin(self, checkinComment=None, **kwargs): +def checkin(self, checkinComment=None, contentFile=None, contentType=None, +properties=None, **kwargs): """ Checks in this :class:`Document` which must be a private @@ -1772,9 +1773,6 @@ def checkin(self, checkinComment=None, **kwargs): False The following optional arguments are NOT supported: - - major - - properties - - contentStream - policies - addACEs - removeACEs @@ -1784,21 +1782,29 @@ def checkin(self, checkinComment=None, **kwargs): if not kwargs.has_key('major'): kwargs['major'] = 'true' -kwargs['checkinComment'] = checkinComment - -ciUrl = self._repository.getRootFolderUrl() +else: +kwargs['major'] = 'false' +props = { +'checkinComment': checkinComment or "", +} +props.update(kwargs) +propCount = 0 +properties = properties or {} +for key, value in properties.iteritems(): +props["propertyId[%s]" % propCount] = key +props["propertyValue[%s]" % propCount] = value +propCount += 1 + +ciUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id + "&cmisaction=checkin" -# TODO don't hardcode major flag -props = {"objectId": self.id, - "cmisaction": "checkIn"} +contentType, body = encode_multipart_formdata(props, contentFile, contentType) # invoke the URL result = self._cmisClient.binding.post(ciUrl.encode('utf-8'), - safe_urlencode(props), - 'application/x-www-form-urle
[jira] [Commented] (CMIS-1002) Allow access to the repository from a CmisObject instance
[ https://issues.apache.org/jira/browse/CMIS-1002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15792501#comment-15792501 ] Laurent Mignon commented on CMIS-1002: -- [~jpotts] The metadata generated by setuptools must not be in the source tree. These are generated when you build an new distribution of the library. These files can be problematic when you install the library from sources. > Allow access to the repository from a CmisObject instance > - > > Key: CMIS-1002 > URL: https://issues.apache.org/jira/browse/CMIS-1002 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib > Environment: Linux, python 2.7.x, Alfresco 5.0.x >Reporter: Laurent Mignon >Assignee: Jeff Potts > Fix For: cmislib 0.6.0 > > > https://github.com/apache/chemistry-cmislib/pull/6 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CMIS-1010) Add ACL/ACE support to cmislib browser binding
[ https://issues.apache.org/jira/browse/CMIS-1010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15859436#comment-15859436 ] Laurent Mignon commented on CMIS-1010: -- A first working draft is proposed here https://github.com/apache/chemistry-cmislib/pull/7 This implementation don't take care of the isDirect attribute on the ACE and doesn't support the propagation as specified into the CMIS1.1 Spec. The problem here is to keep the symmetry between the browser binding and the atompub binding. Any advices are welcome. > Add ACL/ACE support to cmislib browser binding > -- > > Key: CMIS-1010 > URL: https://issues.apache.org/jira/browse/CMIS-1010 > Project: Chemistry > Issue Type: Task > Components: python-cmislib >Affects Versions: cmislib 0.6.0 >Reporter: Jeff Potts > > Add the ability to work with ACL and ACE objects in the browser binding so > that ACLs can be managed on nodes similar to the support provided by the > atompub binding. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (CMIS-1009) Implement getPaths in the cmislib browser binding
[ https://issues.apache.org/jira/browse/CMIS-1009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15988391#comment-15988391 ] Laurent Mignon commented on CMIS-1009: -- [~jpotts] This issue seems to be implemented https://github.com/apache/chemistry-cmislib/blob/trunk/src/cmislib/browser/binding.py#L2016 Do I miss something? > Implement getPaths in the cmislib browser binding > - > > Key: CMIS-1009 > URL: https://issues.apache.org/jira/browse/CMIS-1009 > Project: Chemistry > Issue Type: Task > Components: python-cmislib >Affects Versions: cmislib 0.6.0 >Reporter: Jeff Potts > > Implement getPaths in the cmislib browser binding so that it is equivalent to > the cmislib atompub binding. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (CMIS-1011) Implement getUnfiled in the cmislib browser binding
[ https://issues.apache.org/jira/browse/CMIS-1011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15988417#comment-15988417 ] Laurent Mignon commented on CMIS-1011: -- The unfiled document service seems to be not part of the spec for the browser binding. Am I right? Do I miss something? > Implement getUnfiled in the cmislib browser binding > --- > > Key: CMIS-1011 > URL: https://issues.apache.org/jira/browse/CMIS-1011 > Project: Chemistry > Issue Type: Task > Components: python-cmislib >Affects Versions: cmislib 0.6.0 >Reporter: Jeff Potts > > Implement the getUnfiled method in the cmislib browser binding so that it > works similarly to the implementation provided by the atom pub binding. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Created] (CMIS-1033) AtomPub binding: getRelationships response is not a valid list of AtomPubRelationship
Laurent Mignon created CMIS-1033: Summary: AtomPub binding: getRelationships response is not a valid list of AtomPubRelationship Key: CMIS-1033 URL: https://issues.apache.org/jira/browse/CMIS-1033 Project: Chemistry Issue Type: Bug Components: python-cmislib Affects Versions: cmislib 0.6.0 Reporter: Laurent Mignon The xml document fragment returned by alfresco for a call to the getRelationships service with the AtomPub binding doesn't contains the informations expected to be deserialized into a AtomPubRelationship object -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (CMIS-1008) Add relationship support to cmislib browser binding
[ https://issues.apache.org/jira/browse/CMIS-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16011933#comment-16011933 ] Laurent Mignon commented on CMIS-1008: -- [~jpotts] The implementation is ready to review/merge. see https://github.com/apache/chemistry-cmislib/pull/9 In the same time, I've discovered a bug into the AtomPub binding for the getRelationships service see https://issues.apache.org/jira/browse/CMIS-1033 > Add relationship support to cmislib browser binding > --- > > Key: CMIS-1008 > URL: https://issues.apache.org/jira/browse/CMIS-1008 > Project: Chemistry > Issue Type: Task > Components: python-cmislib >Affects Versions: cmislib 0.6.0 >Reporter: Jeff Potts > > Add relationship support to the browser binding so that it is equivalent to > what is available in the cmislib atompub binding. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Created] (CMIS-1049) getContentStream not working with browser binding
Laurent Mignon created CMIS-1049: Summary: getContentStream not working with browser binding Key: CMIS-1049 URL: https://issues.apache.org/jira/browse/CMIS-1049 Project: Chemistry Issue Type: Bug Components: python-cmislib Affects Versions: cmislib 0.6.0 Reporter: Laurent Mignon Wrong argument used into the url build to request the getContentStream service from the browser binding. The 'selector' arg is used in place of 'cmisselector' into the url. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (CMIS-1059) Py3 Compat
Laurent Mignon created CMIS-1059: Summary: Py3 Compat Key: CMIS-1059 URL: https://issues.apache.org/jira/browse/CMIS-1059 Project: Chemistry Issue Type: Improvement Components: python-cmislib Reporter: Laurent Mignon Make the library compatible with python 3. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CMIS-1059) Py3 Compat
[ https://issues.apache.org/jira/browse/CMIS-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-1059: - Flags: Important > Py3 Compat > -- > > Key: CMIS-1059 > URL: https://issues.apache.org/jira/browse/CMIS-1059 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib >Reporter: Laurent Mignon >Priority: Major > > Make the library compatible with python 3. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CMIS-1059) Py3 Compat
[ https://issues.apache.org/jira/browse/CMIS-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16432252#comment-16432252 ] Laurent Mignon commented on CMIS-1059: -- Implemented in https://github.com/apache/chemistry-cmislib/pull/12 > Py3 Compat > -- > > Key: CMIS-1059 > URL: https://issues.apache.org/jira/browse/CMIS-1059 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib >Reporter: Laurent Mignon >Priority: Major > > Make the library compatible with python 3. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CMIS-1059) Py3 Compat
[ https://issues.apache.org/jira/browse/CMIS-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16561180#comment-16561180 ] Laurent Mignon commented on CMIS-1059: -- [~jpotts] The code is now also available into the official svn repository [https://svn.apache.org/repos/asf/chemistry/cmislib/branches/py3_compat/] Regards lmignon > Py3 Compat > -- > > Key: CMIS-1059 > URL: https://issues.apache.org/jira/browse/CMIS-1059 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib >Reporter: Laurent Mignon >Priority: Major > > Make the library compatible with python 3. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CMIS-1059) Py3 Compat
[ https://issues.apache.org/jira/browse/CMIS-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Laurent Mignon updated CMIS-1059: - Affects Version/s: cmislib 0.6.0 Description: Make the library compatible with Python 3 while remaining compatible with Python 2.7. The first step in the migration process was the implementation of a continuous integration process based on travis and the refactoring of the tests. (see [#10|https://github.com/apache/chemistry-cmislib/pull/10] for the motivations) In a second step, the code was modified syntactically to be both Python 2 and Python 3 compliant. The httplib2 library was then replaced by python-request ([http://docs.python-requests.org/en/master/]). It natively supports Python 2 and Python 3, manages sessions better (perf are improved), has no problem with large files and is very well maintained and documented. This library seems to be a de facto standard. Finally, the code is now flake8. These changes constitute a major evolution of the library. Even if all the unit tests allow us to believe that no regression was introduced by this refactoring, these changes must be validated by an intensive use of the library. was:Make the library compatible with python 3. > Py3 Compat > -- > > Key: CMIS-1059 > URL: https://issues.apache.org/jira/browse/CMIS-1059 > Project: Chemistry > Issue Type: Improvement > Components: python-cmislib >Affects Versions: cmislib 0.6.0 >Reporter: Laurent Mignon >Priority: Major > > Make the library compatible with Python 3 while remaining compatible with > Python 2.7. > > The first step in the migration process was the implementation of a > continuous integration process based on travis and the refactoring of the > tests. (see [#10|https://github.com/apache/chemistry-cmislib/pull/10] for the > motivations) > > In a second step, the code was modified syntactically to be both Python 2 and > Python 3 compliant. > > The httplib2 library was then replaced by python-request > ([http://docs.python-requests.org/en/master/]). It natively supports Python 2 > and Python 3, manages sessions better (perf are improved), has no problem > with large files and is very well maintained and documented. This library > seems to be a de facto standard. > > Finally, the code is now flake8. > > These changes constitute a major evolution of the library. Even if all the > unit tests allow us to believe that no regression was introduced by this > refactoring, these changes must be validated by an intensive use of the > library. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CMIS-1068) py3compat version : Problem with special characters (like '+')
[ https://issues.apache.org/jira/browse/CMIS-1068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16700895#comment-16700895 ] Laurent Mignon commented on CMIS-1068: -- Fixed at revision 1847589 [https://svn.apache.org/repos/asf/chemistry/cmislib/branches/py3_compat] a preview of the change is also visible on github [https://github.com/apache/chemistry-cmislib/pull/12/commits/1468b2899f2169507eb6ecb49a46661d2427c482] > py3compat version : Problem with special characters (like '+') > -- > > Key: CMIS-1068 > URL: https://issues.apache.org/jira/browse/CMIS-1068 > Project: Chemistry > Issue Type: Bug > Components: python-cmislib >Reporter: Denis Roussel >Priority: Major > > When trying to search for a folder with name like 'NAME +', the folder is not > found. > Affect this to Laurent Mignon -- This message was sent by Atlassian JIRA (v7.6.3#76005)