Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B598218DD1 for ; Fri, 25 Mar 2016 15:43:26 +0000 (UTC) Received: (qmail 81591 invoked by uid 500); 25 Mar 2016 15:43:26 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 81538 invoked by uid 500); 25 Mar 2016 15:43:26 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 81523 invoked by uid 99); 25 Mar 2016 15:43:26 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2016 15:43:26 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7A22E2C1F5D for ; Fri, 25 Mar 2016 15:43:25 +0000 (UTC) Date: Fri, 25 Mar 2016 15:43:25 +0000 (UTC) From: "Laurent Mignon (JIRA)" To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CMIS-972) Implement contentStream and properties update in BrowserDocument.checkin method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)