chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpo...@apache.org
Subject svn commit: r1595362 - in /chemistry/cmislib/trunk/src/cmislib: atompub/binding.py browser/binding.py cmis_services.py domain.py model.py net.py util.py
Date Fri, 16 May 2014 21:46:51 GMT
Author: jpotts
Date: Fri May 16 21:46:51 2014
New Revision: 1595362

URL: http://svn.apache.org/r1595362
Log:
cmislib testTypeChildren passing and whitespace cleanup

Modified:
    chemistry/cmislib/trunk/src/cmislib/atompub/binding.py
    chemistry/cmislib/trunk/src/cmislib/browser/binding.py
    chemistry/cmislib/trunk/src/cmislib/cmis_services.py
    chemistry/cmislib/trunk/src/cmislib/domain.py
    chemistry/cmislib/trunk/src/cmislib/model.py
    chemistry/cmislib/trunk/src/cmislib/net.py
    chemistry/cmislib/trunk/src/cmislib/util.py

Modified: chemistry/cmislib/trunk/src/cmislib/atompub/binding.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/atompub/binding.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/atompub/binding.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/atompub/binding.py Fri May 16 21:46:51 2014
@@ -84,6 +84,7 @@ CHECKED_OUT_COLL = 'checkedout'
 UNFILED_COLL = 'unfiled'
 ROOT_COLL = 'root'
 
+
 class AtomPubBinding(Binding):
     def __init__(self, **kwargs):
         self.extArgs = kwargs
@@ -109,9 +110,9 @@ class AtomPubBinding(Binding):
             kwargs.update(self.extArgs)
 
         resp, content = Rest().get(url,
-                            username=username,
-                            password=password,
-                            **kwargs)
+                                   username=username,
+                                   password=password,
+                                   **kwargs)
         if resp['status'] != '200':
             self._processCommonErrors(resp, url)
             return content
@@ -136,9 +137,9 @@ class AtomPubBinding(Binding):
             kwargs.update(self.extArgs)
 
         resp, content = Rest().delete(url,
-                               username=username,
-                               password=password,
-                               **kwargs)
+                                      username=username,
+                                      password=password,
+                                      **kwargs)
         if resp['status'] != '200' and resp['status'] != '204':
             self._processCommonErrors(resp, url)
             return content
@@ -161,11 +162,11 @@ class AtomPubBinding(Binding):
             kwargs.update(self.extArgs)
 
         resp, content = Rest().post(url,
-                             payload,
-                             contentType,
-                             username=username,
-                             password=password,
-                             **kwargs)
+                                    payload,
+                                    contentType,
+                                    username=username,
+                                    password=password,
+                                    **kwargs)
         if resp['status'] == '200':
             try:
                 return minidom.parseString(content)
@@ -196,16 +197,15 @@ class AtomPubBinding(Binding):
             kwargs.update(self.extArgs)
 
         resp, content = Rest().put(url,
-                            payload,
-                            contentType,
-                            username=username,
-                            password=password,
-                            **kwargs)
+                                   payload,
+                                   contentType,
+                                   username=username,
+                                   password=password,
+                                   **kwargs)
         if resp['status'] != '200' and resp['status'] != '201':
             self._processCommonErrors(resp, url)
             return content
         else:
-            #if result.headers['content-length'] != '0':
             try:
                 return minidom.parseString(content)
             except ExpatError:
@@ -221,10 +221,10 @@ class RepositoryService(RepositoryServic
     def reload(self, obj):
         self.logger.debug('Reload called on object')
         obj.xmlDoc = obj._cmisClient.binding.get(obj._cmisClient.repositoryUrl.encode('utf-8'),
-                                         obj._cmisClient.username,
-                                         obj._cmisClient.password)
+                                                 obj._cmisClient.username,
+                                                 obj._cmisClient.password)
         obj._initData()
-        
+
     def getRepository(self, client, repositoryId):
         doc = client.binding.get(client.repositoryUrl, client.username, client.password, **client.extArgs)
         workspaceElements = doc.getElementsByTagNameNS(APP_NS, 'workspace')
@@ -329,14 +329,13 @@ class AtomPubCmisObject(CmisObject):
         # passed in, those will get tacked on to the query string as
         # "additional" options.
 
-        params = {
-              '{id}': self.getObjectId(),
-              '{filter}': '',
-              '{includeAllowableActions}': 'false',
-              '{includePolicyIds}': 'false',
-              '{includeRelationships}': '',
-              '{includeACL}': 'false',
-              '{renditionFilter}': ''}
+        params = {'{id}': self.getObjectId(),
+                  '{filter}': '',
+                  '{includeAllowableActions}': 'false',
+                  '{includePolicyIds}': 'false',
+                  '{includeRelationships}': '',
+                  '{includeACL}': 'false',
+                  '{renditionFilter}': ''}
 
         options = {}
         addOptions = {}  # args specified, but not in the template
@@ -529,15 +528,15 @@ class AtomPubCmisObject(CmisObject):
         The optional filter argument is not yet implemented.
         """
 
-        #TODO implement filter
+        # TODO implement filter
         if self._properties == {}:
             if self.xmlDoc is None:
                 self.reload()
             propertiesElement = self.xmlDoc.getElementsByTagNameNS(CMIS_NS, 'properties')[0]
-            #cpattern = re.compile(r'^property([\w]*)')
+            # cpattern = re.compile(r'^property([\w]*)')
             for node in [e for e in propertiesElement.childNodes if e.nodeType == e.ELEMENT_NODE and e.namespaceURI == CMIS_NS]:
-                #propertyId, propertyString, propertyDateTime
-                #propertyType = cpattern.search(node.localName).groups()[0]
+                # propertyId, propertyString, propertyDateTime
+                # propertyType = cpattern.search(node.localName).groups()[0]
                 propertyName = node.attributes['propertyDefinitionId'].value
                 if node.childNodes and \
                    node.getElementsByTagNameNS(CMIS_NS, 'value')[0] and \
@@ -551,8 +550,8 @@ class AtomPubCmisObject(CmisObject):
                         propertyValue = []
                         for valNode in valNodeList:
                             propertyValue.append(parsePropValue(valNode.
-                                                       childNodes[0].data,
-                                                       node.localName))
+                                                                childNodes[0].data,
+                                                                node.localName))
                 else:
                     propertyValue = None
                 self._properties[propertyName] = propertyValue
@@ -606,15 +605,13 @@ class AtomPubCmisObject(CmisObject):
 
         # if we have a change token, we must pass it back, per the spec
         args = {}
-        if (self.properties.has_key('cmis:changeToken') and
-                    self.properties['cmis:changeToken'] is not None):
+        if (self.properties.has_key('cmis:changeToken') and self.properties['cmis:changeToken'] is not None):
             self.logger.debug('Change token present, adding it to args')
             args = {"changeToken": self.properties['cmis:changeToken']}
 
         # the getEntryXmlDoc function may need the object type
         objectTypeId = None
-        if (self.properties.has_key('cmis:objectTypeId') and
-            not properties.has_key('cmis:objectTypeId')):
+        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)
 
@@ -625,11 +622,11 @@ class AtomPubCmisObject(CmisObject):
 
         # do a PUT of the entry
         updatedXmlDoc = self._cmisClient.binding.put(selfUrl.encode('utf-8'),
-                                             self._cmisClient.username,
-                                             self._cmisClient.password,
-                                             xmlEntryDoc.toxml(encoding='utf-8'),
-                                             ATOM_XML_TYPE,
-                                             **args)
+                                                     self._cmisClient.username,
+                                                     self._cmisClient.password,
+                                                     xmlEntryDoc.toxml(encoding='utf-8'),
+                                                     ATOM_XML_TYPE,
+                                                     **args)
 
         # reset the xmlDoc for this object with what we got back from
         # the PUT, then call initData we dont' want to call
@@ -656,11 +653,11 @@ class AtomPubCmisObject(CmisObject):
 
         # post the Atom entry
         self._cmisClient.binding.post(postUrl.encode('utf-8'),
-                                               self._cmisClient.username,
-                                               self._cmisClient.password,
-                                               self.xmlDoc.toxml(encoding='utf-8'),
-                                               ATOM_XML_ENTRY_TYPE,
-                                               **args)
+                                      self._cmisClient.username,
+                                      self._cmisClient.password,
+                                      self.xmlDoc.toxml(encoding='utf-8'),
+                                      ATOM_XML_ENTRY_TYPE,
+                                      **args)
 
     def delete(self, **kwargs):
 
@@ -678,9 +675,9 @@ class AtomPubCmisObject(CmisObject):
 
         url = self._getSelfLink()
         self._cmisClient.binding.delete(url.encode('utf-8'),
-                                         self._cmisClient.username,
-                                         self._cmisClient.password,
-                                         **kwargs)
+                                        self._cmisClient.username,
+                                        self._cmisClient.password,
+                                        **kwargs)
 
     def applyPolicy(self, policyId):
 
@@ -805,8 +802,8 @@ class AtomPubCmisObject(CmisObject):
             # supported
             aclUrl = self._getLink(ACL_REL)
             result = self._cmisClient.binding.get(aclUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password)
             return AtomPubACL(xmlDoc=result)
         else:
             raise NotSupportedException
@@ -834,10 +831,10 @@ class AtomPubCmisObject(CmisObject):
             aclUrl = self._getLink(ACL_REL)
             assert aclUrl, "Could not determine the object's ACL URL."
             result = self._cmisClient.binding.put(aclUrl.encode('utf-8'),
-                                          self._cmisClient.username,
-                                          self._cmisClient.password,
-                                          acl.getXmlDoc().toxml(encoding='utf-8'),
-                                          CMIS_ACL_TYPE)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password,
+                                                  acl.getXmlDoc().toxml(encoding='utf-8'),
+                                                  CMIS_ACL_TYPE)
             return AtomPubACL(xmlDoc=result)
         else:
             raise NotSupportedException
@@ -1270,8 +1267,8 @@ class AtomPubRepository(object):
             types = []
             for entryElement in entryElements:
                 objectType = AtomPubObjectType(self._cmisClient,
-                                        self,
-                                        xmlDoc=entryElement)
+                                               self,
+                                               xmlDoc=entryElement)
                 types.append(objectType)
         # otherwise, if a typeId is not specified, return
         # the list of base types
@@ -1335,15 +1332,15 @@ class AtomPubRepository(object):
             raise NotSupportedException("Could not determine the type descendants URL")
 
         typesXmlDoc = self._cmisClient.binding.get(descendUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password,
-                                              **kwargs)
+                                                   self._cmisClient.username,
+                                                   self._cmisClient.password,
+                                                   **kwargs)
         entryElements = typesXmlDoc.getElementsByTagNameNS(ATOM_NS, 'entry')
         types = []
         for entryElement in entryElements:
             objectType = AtomPubObjectType(self._cmisClient,
-                                    self,
-                                    xmlDoc=entryElement)
+                                           self,
+                                           xmlDoc=entryElement)
             types.append(objectType)
         return types
 
@@ -1372,8 +1369,8 @@ class AtomPubRepository(object):
         types = []
         for entryElement in entryElements:
             objectType = AtomPubObjectType(self._cmisClient,
-                                    self,
-                                    xmlDoc=entryElement)
+                                           self,
+                                           xmlDoc=entryElement)
             types.append(objectType)
         # return the result
         return types
@@ -1505,14 +1502,13 @@ class AtomPubRepository(object):
         template = self.getUriTemplates()['objectbypath']['template']
 
         # fill in the template with the path provided
-        params = {
-              '{path}': quote(path, '/'),
-              '{filter}': '',
-              '{includeAllowableActions}': 'false',
-              '{includePolicyIds}': 'false',
-              '{includeRelationships}': '',
-              '{includeACL}': 'false',
-              '{renditionFilter}': ''}
+        params = {'{path}': quote(path, '/'),
+                  '{filter}': '',
+                  '{includeAllowableActions}': 'false',
+                  '{includePolicyIds}': 'false',
+                  '{includeRelationships}': '',
+                  '{includeACL}': 'false',
+                  '{renditionFilter}': ''}
 
         options = {}
         addOptions = {}  # args specified, but not in the template
@@ -1592,7 +1588,7 @@ class AtomPubRepository(object):
         xmlDoc = self._getQueryXmlDoc(statement, **kwargs)
 
         # do the POST
-        #print 'posting:%s' % xmlDoc.toxml(encoding='utf-8')
+        # print 'posting:%s' % xmlDoc.toxml(encoding='utf-8')
         result = self._cmisClient.binding.post(queryUrl.encode('utf-8'),
                                                self._cmisClient.username,
                                                self._cmisClient.password,
@@ -1685,14 +1681,14 @@ class AtomPubRepository(object):
             # if the repository doesn't require fileable objects to be filed
             if self.getCapabilities()['Unfiling']:
                 # has not been implemented
-                #postUrl = self.getCollectionLink(UNFILED_COLL)
+                # postUrl = self.getCollectionLink(UNFILED_COLL)
                 raise NotImplementedError
             else:
                 # this repo requires fileable objects to be filed
                 raise InvalidArgumentException
 
         return parentFolder.createDocument(name, properties, StringIO.StringIO(contentString),
-            contentType, contentEncoding)
+                                           contentType, contentEncoding)
 
     def createDocument(self,
                        name,
@@ -1732,7 +1728,7 @@ class AtomPubRepository(object):
             # if the repository doesn't require fileable objects to be filed
             if self.getCapabilities()['Unfiling']:
                 # has not been implemented
-                #postUrl = self.getCollectionLink(UNFILED_COLL)
+                # postUrl = self.getCollectionLink(UNFILED_COLL)
                 raise NotImplementedError
             else:
                 # this repo requires fileable objects to be filed
@@ -1864,8 +1860,8 @@ class AtomPubRepository(object):
                         mediatype = node.childNodes[0].data
 
                 self._uriTemplates[templType] = UriTemplate(template,
-                                                       templType,
-                                                       mediatype)
+                                                            templType,
+                                                            mediatype)
 
         return self._uriTemplates
 
@@ -1942,9 +1938,9 @@ class AtomPubRepository(object):
         cmisXmlDoc.appendChild(queryElement)
 
         statementElement = cmisXmlDoc.createElementNS(CMIS_NS, "statement")
-        #CMIS-703
-        #cdataSection = cmisXmlDoc.createCDATASection(query)
-        #statementElement.appendChild(cdataSection)
+        # CMIS-703
+        # cdataSection = cmisXmlDoc.createCDATASection(query)
+        # statementElement.appendChild(cdataSection)
         textNode = cmisXmlDoc.createTextNode(query)
         statementElement.appendChild(textNode)
         queryElement.appendChild(statementElement)
@@ -2021,8 +2017,8 @@ class AtomPubResultSet(ResultSet):
         link = self._getLink(rel)
         if link:
             result = self._cmisClient.binding.get(link.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password)
 
             # return the result
             self._xmlDoc = result
@@ -2368,11 +2364,11 @@ class AtomPubDocument(AtomPubCmisObject)
         # Do a PUT of the empty ATOM to the self link
         url = self._getSelfLink()
         result = self._cmisClient.binding.put(url.encode('utf-8'),
-                                      self._cmisClient.username,
-                                      self._cmisClient.password,
-                                      entryXmlDoc.toxml(encoding='utf-8'),
-                                      ATOM_XML_TYPE,
-                                      **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              entryXmlDoc.toxml(encoding='utf-8'),
+                                              ATOM_XML_TYPE,
+                                              **kwargs)
 
         return AtomPubDocument(self._cmisClient, self._repository, xmlDoc=result)
 
@@ -2468,7 +2464,7 @@ class AtomPubDocument(AtomPubCmisObject)
 
         contentElements = self.xmlDoc.getElementsByTagNameNS(ATOM_NS, 'content')
 
-        #CMIS-701
+        # CMIS-701
         if len(contentElements) != 1:
             self.reload()
             contentElements = self.xmlDoc.getElementsByTagNameNS(ATOM_NS, 'content')
@@ -2481,9 +2477,9 @@ class AtomPubDocument(AtomPubCmisObject)
 
             # the cmis client class parses non-error responses
             result, content = Rest().get(srcUrl.encode('utf-8'),
-                                username=self._cmisClient.username,
-                                password=self._cmisClient.password,
-                                **self._cmisClient.extArgs)
+                                         username=self._cmisClient.username,
+                                         password=self._cmisClient.password,
+                                         **self._cmisClient.extArgs)
             if result['status'] != '200':
                 raise CmisException(result['status'])
             return StringIO.StringIO(content)
@@ -2524,18 +2520,17 @@ class AtomPubDocument(AtomPubCmisObject)
 
         # if we have a change token, we must pass it back, per the spec
         args = {}
-        if (self.properties.has_key('cmis:changeToken') and
-                    self.properties['cmis:changeToken'] is not None):
+        if (self.properties.has_key('cmis:changeToken') and self.properties['cmis:changeToken'] is not None):
             self.logger.debug('Change token present, adding it to args')
             args = {"changeToken": self.properties['cmis:changeToken']}
 
         # put the content file
         result = self._cmisClient.binding.put(srcUrl.encode('utf-8'),
-                                      self._cmisClient.username,
-                                      self._cmisClient.password,
-                                      contentFile.read(),
-                                      mimetype,
-                                      **args)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              contentFile.read(),
+                                              mimetype,
+                                              **args)
 
         # what comes back is the XML for the updated document,
         # which is not required by the spec to be the same document
@@ -2564,16 +2559,15 @@ class AtomPubDocument(AtomPubCmisObject)
 
         # if we have a change token, we must pass it back, per the spec
         args = {}
-        if (self.properties.has_key('cmis:changeToken') and
-                    self.properties['cmis:changeToken'] is not None):
+        if (self.properties.has_key('cmis:changeToken') and self.properties['cmis:changeToken'] is not None):
             self.logger.debug('Change token present, adding it to args')
             args = {"changeToken": self.properties['cmis:changeToken']}
 
         # delete the content stream
         self._cmisClient.binding.delete(srcUrl.encode('utf-8'),
-                                         self._cmisClient.username,
-                                         self._cmisClient.password,
-                                         **args)
+                                        self._cmisClient.username,
+                                        self._cmisClient.password,
+                                        **args)
 
     checkedOut = property(isCheckedOut)
 
@@ -2686,10 +2680,10 @@ class AtomPubFolder(AtomPubCmisObject):
         """
 
         return self._repository.createDocumentFromString(name, properties,
-            self, contentString, contentType, contentEncoding)
+                                                         self, contentString, contentType, contentEncoding)
 
     def createDocument(self, name, properties={}, contentFile=None,
-            contentType=None, contentEncoding=None):
+                       contentType=None, contentEncoding=None):
 
         """
         Creates a new Document object in the repository using
@@ -2933,9 +2927,9 @@ class AtomPubFolder(AtomPubCmisObject):
         # Get the descendants link and do a DELETE against it
         url = self._getLink(DOWN_REL, CMIS_TREE_TYPE_P)
         result = self._cmisClient.binding.delete(url.encode('utf-8'),
-                                         self._cmisClient.username,
-                                         self._cmisClient.password,
-                                         **kwargs)
+                                                 self._cmisClient.username,
+                                                 self._cmisClient.password,
+                                                 **kwargs)
 
     def addObject(self, cmisObject, **kwargs):
 
@@ -2967,11 +2961,11 @@ class AtomPubFolder(AtomPubCmisObject):
 
         # post the Atom entry
         self._cmisClient.binding.post(postUrl.encode('utf-8'),
-                                               self._cmisClient.username,
-                                               self._cmisClient.password,
-                                               cmisObject.xmlDoc.toxml(encoding='utf-8'),
-                                               ATOM_XML_ENTRY_TYPE,
-                                               **kwargs)
+                                      self._cmisClient.username,
+                                      self._cmisClient.password,
+                                      cmisObject.xmlDoc.toxml(encoding='utf-8'),
+                                      ATOM_XML_ENTRY_TYPE,
+                                      **kwargs)
 
     def removeObject(self, cmisObject):
 
@@ -2989,11 +2983,11 @@ class AtomPubFolder(AtomPubCmisObject):
 
         # post the Atom entry to the unfiled collection
         self._cmisClient.binding.post(postUrl.encode('utf-8'),
-                                               self._cmisClient.username,
-                                               self._cmisClient.password,
-                                               cmisObject.xmlDoc.toxml(encoding='utf-8'),
-                                               ATOM_XML_ENTRY_TYPE,
-                                               **args)
+                                      self._cmisClient.username,
+                                      self._cmisClient.password,
+                                      cmisObject.xmlDoc.toxml(encoding='utf-8'),
+                                      ATOM_XML_ENTRY_TYPE,
+                                      **args)
 
     def getPaths(self):
         """
@@ -3114,9 +3108,9 @@ class AtomPubObjectType(ObjectType):
 
         if self.xmlDoc is None:
             self.reload()
-        #typeEls = self.xmlDoc.getElementsByTagNameNS(CMISRA_NS, 'type')
-        #assert len(typeEls) == 1, "Expected to find exactly one type element but instead found %d" % len(typeEls)
-        #typeEl = typeEls[0]
+        # typeEls = self.xmlDoc.getElementsByTagNameNS(CMISRA_NS, 'type')
+        # assert len(typeEls) == 1, "Expected to find exactly one type element but instead found %d" % len(typeEls)
+        # typeEl = typeEls[0]
         typeEl = None
         for e in self.xmlDoc.childNodes:
             if e.nodeType == e.ELEMENT_NODE and e.localName == "type":
@@ -3543,19 +3537,19 @@ class AtomPubACL(ACL):
         aclEl.setAttribute('xmlns:cmis', CMIS_NS)
         for ace in self.getEntries().values():
             permEl = xmlDoc.createElementNS(CMIS_NS, 'cmis:permission')
-            #principalId
+            # principalId
             prinEl = xmlDoc.createElementNS(CMIS_NS, 'cmis:principal')
             prinIdEl = xmlDoc.createElementNS(CMIS_NS, 'cmis:principalId')
             prinIdElText = xmlDoc.createTextNode(ace.principalId)
             prinIdEl.appendChild(prinIdElText)
             prinEl.appendChild(prinIdEl)
             permEl.appendChild(prinEl)
-            #direct
+            # direct
             directEl = xmlDoc.createElementNS(CMIS_NS, 'cmis:direct')
             directElText = xmlDoc.createTextNode(ace.direct)
             directEl.appendChild(directElText)
             permEl.appendChild(directEl)
-            #permissions
+            # permissions
             for perm in ace.permissions:
                 permItemEl = xmlDoc.createElementNS(CMIS_NS, 'cmis:permission')
                 permItemElText = xmlDoc.createTextNode(perm)
@@ -3664,8 +3658,8 @@ class AtomPubChangeEntry(ChangeEntry):
             return AtomPubACL(aceList=aclEls[0])
         elif aclUrl:
             result = self._cmisClient.binding.get(aclUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password)
             return AtomPubACL(xmlDoc=result)
 
     def getChangeTime(self):
@@ -3694,8 +3688,8 @@ class AtomPubChangeEntry(ChangeEntry):
                    node.getElementsByTagNameNS(CMIS_NS, 'value')[0] and \
                    node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes:
                     propertyValue = parsePropValue(
-                       node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes[0].data,
-                       node.localName)
+                        node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes[0].data,
+                        node.localName)
                 else:
                     propertyValue = None
                 self._properties[propertyName] = propertyValue
@@ -3723,6 +3717,7 @@ class AtomPubChangeEntry(ChangeEntry):
     changeType = property(getChangeType)
     properties = property(getProperties)
 
+
 class AtomPubChangeEntry(object):
     """
     Represents a change log entry. Retrieve a list of change entries via
@@ -3812,8 +3807,8 @@ class AtomPubChangeEntry(object):
             return AtomPubACL(aceList=aclEls[0])
         elif aclUrl:
             result = self._cmisClient.binding.get(aclUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password)
             return AtomPubACL(xmlDoc=result)
 
     def getChangeTime(self):
@@ -3842,8 +3837,8 @@ class AtomPubChangeEntry(object):
                    node.getElementsByTagNameNS(CMIS_NS, 'value')[0] and \
                    node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes:
                     propertyValue = parsePropValue(
-                       node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes[0].data,
-                       node.localName)
+                        node.getElementsByTagNameNS(CMIS_NS, 'value')[0].childNodes[0].data,
+                        node.localName)
                 else:
                     propertyValue = None
                 self._properties[propertyName] = propertyValue
@@ -4008,6 +4003,7 @@ class AtomPubCmisId(CmisId):
 
     pass
 
+
 def getSpecializedObject(obj, **kwargs):
 
     """
@@ -4034,8 +4030,9 @@ def getSpecializedObject(obj, **kwargs):
     # types, give the object back
     return obj
 
+
 def getEntryXmlDoc(repo=None, objectTypeId=None, properties=None, contentFile=None,
-                    contentType=None, contentEncoding=None):
+                   contentType=None, contentEncoding=None):
 
     """
     Internal helper method that knows how to build an Atom entry based
@@ -4115,7 +4112,7 @@ def getEntryXmlDoc(repo=None, objectType
                 if typeDef is None:
                     moduleLogger.debug('Looking up type def for: %s' % objectTypeId)
                     typeDef = repo.getTypeDefinition(objectTypeId)
-                    #TODO what to do if type not found
+                    # TODO what to do if type not found
                 propType = typeDef.properties[propName].propertyType
             elif type(propValue) == list:
                 propType = type(propValue[0])
@@ -4137,6 +4134,7 @@ def getEntryXmlDoc(repo=None, objectType
 
     return entryXmlDoc
 
+
 def getElementNameAndValues(propType, propName, propValue, isList=False):
 
     """
@@ -4248,5 +4246,4 @@ def getEmptyXmlDoc():
     entryElement = entryXmlDoc.createElementNS(ATOM_NS, "entry")
     entryElement.setAttribute('xmlns', ATOM_NS)
     entryXmlDoc.appendChild(entryElement)
-    return entryXmlDoc
-
+    return entryXmlDoc
\ No newline at end of file

Modified: chemistry/cmislib/trunk/src/cmislib/browser/binding.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/browser/binding.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/browser/binding.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/browser/binding.py Fri May 16 21:46:51 2014
@@ -35,6 +35,7 @@ CMIS_FORM_TYPE = 'application/x-www-form
 
 moduleLogger = logging.getLogger('cmislib.browser.binding')
 
+
 class BrowserBinding(Binding):
     def __init__(self, **kwargs):
         self.extArgs = kwargs
@@ -60,9 +61,9 @@ class BrowserBinding(Binding):
             kwargs.update(self.extArgs)
 
         resp, content = Rest().get(url,
-                            username=username,
-                            password=password,
-                            **kwargs)
+                                   username=username,
+                                   password=password,
+                                   **kwargs)
         result = None
         if resp['status'] != '200':
             self._processCommonErrors(resp, url)
@@ -87,11 +88,11 @@ class BrowserBinding(Binding):
 
         result = None
         resp, content = Rest().post(url,
-                             payload,
-                             contentType,
-                             username=username,
-                             password=password,
-                             **kwargs)
+                                    payload,
+                                    contentType,
+                                    username=username,
+                                    password=password,
+                                    **kwargs)
         if resp['status'] != '200' and resp['status'] != '201':
             self._processCommonErrors(resp, url)
         elif content is not None and content != "":
@@ -102,7 +103,7 @@ class BrowserBinding(Binding):
 class RepositoryService(RepositoryServiceIfc):
     def getRepository(self, client, repositoryId):
         result = client.binding.get(client.repositoryUrl, client.username, client.password, **client.extArgs)
-        
+
         if repositoryId in result:
             return BrowserRepository(client, result[repositoryId])
 
@@ -180,9 +181,9 @@ class BrowserCmisObject(object):
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=object"
         self.data = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **self._extArgs)
+                                                 self._cmisClient.username,
+                                                 self._cmisClient.password,
+                                                 **self._extArgs)
         self._initData()
 
         # if a returnVersion arg was passed in, it is possible we got back
@@ -190,7 +191,7 @@ class BrowserCmisObject(object):
         # to be cleared out as well
         if self._extArgs.has_key('returnVersion'):
             self._objectId = None
-    
+
     def getObjectId(self):
 
         """
@@ -220,16 +221,15 @@ class BrowserCmisObject(object):
          - includeAllowableActions
          - includeRelativePathSegment
         """
-        #TODO add kwargs logic here
 
         if not self.getAllowableActions()['canGetObjectParents']:
             raise NotSupportedException('Object does not support getObjectParents')
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=parents"
         result = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         # return the result set
         return BrowserResultSet(self._cmisClient, self._repository, {'objects': result}, serializer=ChildrenSerializer())
 
@@ -295,7 +295,7 @@ class BrowserCmisObject(object):
                 self.reload()
             for prop in self.data['properties'].itervalues():
                 self._properties[prop['id']] = parsePropValueByType(prop['value'], prop['type'])
-                
+
         return self._properties
 
     def getName(self):
@@ -331,7 +331,7 @@ class BrowserCmisObject(object):
         # get the root folder URL
         updateUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.id
 
-        props = {"cmisaction" : "update"}
+        props = {"cmisaction": "update"}
 
         propCount = 0
         for prop in properties:
@@ -367,10 +367,10 @@ class BrowserCmisObject(object):
         '''
         moveUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "move",
-                 "sourceFolderId" : sourceFolder.id,
-                 "targetFolderId" : targetFolder.id}
+        props = {"objectId": self.id,
+                 "cmisaction": "move",
+                 "sourceFolderId": sourceFolder.id,
+                 "targetFolderId": targetFolder.id}
 
         # invoke the URL
         result = self._cmisClient.binding.post(moveUrl.encode('utf-8'),
@@ -381,7 +381,6 @@ class BrowserCmisObject(object):
 
         return
 
-
     def delete(self, **kwargs):
 
         """
@@ -398,8 +397,8 @@ class BrowserCmisObject(object):
 
         delUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "delete"}
+        props = {"objectId": self.id,
+                 "cmisaction": "delete"}
 
         # invoke the URL
         result = self._cmisClient.binding.post(delUrl.encode('utf-8'),
@@ -411,7 +410,6 @@ class BrowserCmisObject(object):
 
         return
 
-
     def applyPolicy(self, policyId):
 
         """
@@ -493,8 +491,8 @@ class BrowserCmisObject(object):
             # supported
             aclUrl = self._repository.getRootFolderUrl() + "?cmisselector=object&objectId=" + self.getObjectId() + "&includeACL=true"
             result = self._cmisClient.binding.get(aclUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password)
+                                                  self._cmisClient.username,
+                                                  self._cmisClient.password)
             return BrowserACL(data=result['acl'])
         else:
             raise NotSupportedException
@@ -537,7 +535,6 @@ class BrowserCmisObject(object):
         else:
             raise NotSupportedException
 
-
     allowableActions = property(getAllowableActions)
     name = property(getName)
     id = property(getObjectId)
@@ -611,7 +608,7 @@ class BrowserRepository(object):
                 self.reload()
             self._repositoryId = self.data['repositoryId']
         return self._repositoryId
-    
+
     def getRepositoryName(self):
 
         """
@@ -700,14 +697,14 @@ class BrowserRepository(object):
             else:
                 self._extArgs = kwargs
         '''
-        #TODO why is quoting the path required for the browser binding and not for atom pub
-        #on inmemory 0.9?
-        #TODO maybe we should quote all urls in the net library instead of here
+        # TODO why is quoting the path required for the browser binding and not for atom pub
+        # on inmemory 0.9?
+        # TODO maybe we should quote all urls in the net library instead of here
         byPathUrl = self.getRootFolderUrl() + quote(path) + "?cmisselector=object"
         result = self._cmisClient.binding.get(byPathUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         return getSpecializedObject(BrowserCmisObject(self._cmisClient, self, data=result, **kwargs), **kwargs)
 
     def getSupportedPermissions(self):
@@ -886,7 +883,8 @@ class BrowserRepository(object):
         return BrowserFolder(self._cmisClient, self, data=retObject.data)
 
     def getTypeChildren(self,
-                        typeId=None):
+                        typeId=None,
+                        **kwargs):
 
         """
         Returns a list of :class:`ObjectType` objects corresponding to the
@@ -910,7 +908,23 @@ class BrowserRepository(object):
         cmis:policy
         """
 
-        pass
+        typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren"
+
+        if typeId is not None:
+            typesUrl += "&typeId=%s" % (quote(typeId))
+
+        result = self._cmisClient.binding.get(typesUrl,
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
+        types = []
+        for res in result['types']:
+            objectType = BrowserObjectType(self._cmisClient,
+                                           self,
+                                           data=res)
+            types.append(objectType)
+        # return the result
+        return types
 
     def getTypeDescendants(self, typeId=None, **kwargs):
 
@@ -974,14 +988,14 @@ class BrowserRepository(object):
         typesUrl = self.getRepositoryUrl() + "?cmisselector=typeChildren"
 
         result = self._cmisClient.binding.get(typesUrl,
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         types = []
         for res in result['types']:
             objectType = BrowserObjectType(self._cmisClient,
-                                    self,
-                                    data=res)
+                                           self,
+                                           data=res)
             types.append(objectType)
         # return the result
         return types
@@ -993,16 +1007,16 @@ class BrowserRepository(object):
 
         >>> folderType = repo.getTypeDefinition('cmis:folder')
         """
-        #localhost:8080/chemistry/browser/A1?cmisselector=typeDefinition&typeId=cmis:folder
+        # localhost:8080/chemistry/browser/A1?cmisselector=typeDefinition&typeId=cmis:folder
         typesUrl = self.getRepositoryUrl() + "?cmisselector=typeDefinition" + \
-                    "&typeId=" + typeId
+            "&typeId=" + typeId
         result = self._cmisClient.binding.get(typesUrl,
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password)
 
         return BrowserObjectType(self._cmisClient,
-                                    self,
-                                    data=result)
+                                 self,
+                                 data=result)
 
     def getCheckedOutDocs(self, **kwargs):
 
@@ -1033,13 +1047,13 @@ class BrowserRepository(object):
         typesUrl = self.getRepositoryUrl() + "?cmisselector=checkedOut"
 
         result = self._cmisClient.binding.get(typesUrl,
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
 
         return BrowserResultSet(self._cmisClient,
-                                    self,
-                                    data=result)
+                                self,
+                                data=result)
 
     def getUnfiledDocs(self, **kwargs):
 
@@ -1149,7 +1163,6 @@ class BrowserRepository(object):
         # return the result set
         return BrowserResultSet(self._cmisClient, self, result, serializer=ResultsSerializer())
 
-
     def getContentChanges(self, **kwargs):
 
         """
@@ -1223,14 +1236,14 @@ class BrowserRepository(object):
             # if the repository doesn't require fileable objects to be filed
             if self.getCapabilities()['Unfiling']:
                 # has not been implemented
-                #postUrl = self.getCollectionLink(UNFILED_COLL)
+                # postUrl = self.getCollectionLink(UNFILED_COLL)
                 raise NotImplementedError
             else:
                 # this repo requires fileable objects to be filed
                 raise InvalidArgumentException
 
         return parentFolder.createDocument(name, properties, StringIO.StringIO(contentString),
-            contentType, contentEncoding)
+                                           contentType, contentEncoding)
 
     def createDocument(self,
                        name,
@@ -1277,10 +1290,10 @@ class BrowserRepository(object):
         # get the root folder URL
         createDocUrl = self.getRootFolderUrl()
 
-        props = {"objectId" : parentFolder.id,
-                 "cmisaction" : "createDocument",
-                 "propertyId[0]" : "cmis:name",
-                 "propertyValue[0]" : name}
+        props = {"objectId": parentFolder.id,
+                 "cmisaction": "createDocument",
+                 "propertyId[0]": "cmis:name",
+                 "propertyValue[0]": name}
 
         props["propertyId[1]"] = "cmis:objectTypeId"
         if properties.has_key('cmis:objectTypeId'):
@@ -1610,8 +1623,8 @@ class BrowserDocument(BrowserCmisObject)
 
         coUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "checkOut"}
+        props = {"objectId": self.id,
+                 "cmisaction": "checkOut"}
 
         # invoke the URL
         result = self._cmisClient.binding.post(coUrl.encode('utf-8'),
@@ -1622,7 +1635,6 @@ class BrowserDocument(BrowserCmisObject)
 
         return getSpecializedObject(BrowserCmisObject(self._cmisClient, self._repository, data=result))
 
-
     def cancelCheckout(self):
         """
         Cancels the checkout of this object by retrieving the Private Working
@@ -1638,8 +1650,8 @@ class BrowserDocument(BrowserCmisObject)
 
         coUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "cancelCheckOut"}
+        props = {"objectId": self.id,
+                 "cmisaction": "cancelCheckOut"}
 
         # invoke the URL
         result = self._cmisClient.binding.post(coUrl.encode('utf-8'),
@@ -1728,7 +1740,7 @@ class BrowserDocument(BrowserCmisObject)
          - addACEs
          - removeACEs
         """
-        #TODO implement optional arguments
+        # 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'
@@ -1737,9 +1749,9 @@ class BrowserDocument(BrowserCmisObject)
 
         ciUrl = self._repository.getRootFolderUrl()
 
-        #TODO don't hardcode major flag
-        props = {"objectId" : self.id,
-                 "cmisaction" : "checkIn"}
+        # TODO don't hardcode major flag
+        props = {"objectId": self.id,
+                 "cmisaction": "checkIn"}
 
         # invoke the URL
         result = self._cmisClient.binding.post(ciUrl.encode('utf-8'),
@@ -1844,9 +1856,9 @@ class BrowserDocument(BrowserCmisObject)
 
         contentUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&selector=content"
         result, content = Rest().get(contentUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password,
-                                              **self._cmisClient.extArgs)
+                                     self._cmisClient.username,
+                                     self._cmisClient.password,
+                                     **self._cmisClient.extArgs)
         if result['status'] != '200':
             raise CmisException(result['status'])
         return StringIO.StringIO(content)
@@ -1875,7 +1887,6 @@ class BrowserDocument(BrowserCmisObject)
         # return the result set
         return BrowserDocument(self._cmisClient, self, data=result)
 
-
     def deleteContentStream(self):
 
         """
@@ -1887,8 +1898,8 @@ class BrowserDocument(BrowserCmisObject)
 
         delUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "deleteContent"}
+        props = {"objectId": self.id,
+                 "cmisaction": "deleteContent"}
 
         if self.properties.has_key('cmis:changeToken'):
             props["changeToken"] = self.properties['cmis:changeToken']
@@ -1924,9 +1935,9 @@ class BrowserDocument(BrowserCmisObject)
 
         contentUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=renditions&renditionFilter=*"
         result, content = Rest().get(contentUrl.encode('utf-8'),
-                                              self._cmisClient.username,
-                                              self._cmisClient.password,
-                                              **self._cmisClient.extArgs)
+                                     self._cmisClient.username,
+                                     self._cmisClient.password,
+                                     **self._cmisClient.extArgs)
         if result['status'] != '200':
             raise CmisException(result['status'])
 
@@ -1947,12 +1958,12 @@ class BrowserDocument(BrowserCmisObject)
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=parents&includerelativepathsegment=true"
         result = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password)
-        
+                                              self._cmisClient.username,
+                                              self._cmisClient.password)
+
         paths = []
         rs = self.getObjectParents()
-        #TODO why is the call to getObjectParents() made if it isn't used?
+        # TODO why is the call to getObjectParents() made if it isn't used?
         for res in result:
             path = res['object']['properties']['cmis:path']['value']
             logging.debug(path)
@@ -1998,10 +2009,10 @@ class BrowserFolder(BrowserCmisObject):
         # get the root folder URL
         createFolderUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "createFolder",
-                 "propertyId[0]" : "cmis:name",
-                 "propertyValue[0]" : name}
+        props = {"objectId": self.id,
+                 "cmisaction": "createFolder",
+                 "propertyId[0]": "cmis:name",
+                 "propertyValue[0]": name}
 
         props["propertyId[1]"] = "cmis:objectTypeId"
         if properties.has_key('cmis:objectTypeId'):
@@ -2052,7 +2063,7 @@ class BrowserFolder(BrowserCmisObject):
                                                          contentEncoding)
 
     def createDocument(self, name, properties={}, contentFile=None,
-            contentType=None, contentEncoding=None):
+                       contentType=None, contentEncoding=None):
 
         """
         Creates a new Document object in the repository using
@@ -2124,9 +2135,9 @@ class BrowserFolder(BrowserCmisObject):
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=children"
         result = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         # return the result set
         return BrowserResultSet(self._cmisClient, self._repository, result, serializer=ChildrenSerializer())
 
@@ -2164,13 +2175,12 @@ class BrowserFolder(BrowserCmisObject):
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=descendants"
         result = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         # return the result set
         return BrowserResultSet(self._cmisClient, self._repository, result, serializer=TreeSerializer())
 
-
     def getTree(self, **kwargs):
 
         """
@@ -2199,9 +2209,9 @@ class BrowserFolder(BrowserCmisObject):
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=foldertree"
         result = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         # return the result set
         return BrowserResultSet(self._cmisClient, self._repository, result, serializer=TreeSerializer())
 
@@ -2231,8 +2241,8 @@ class BrowserFolder(BrowserCmisObject):
 
         delUrl = self._repository.getRootFolderUrl()
 
-        props = {"objectId" : self.id,
-                 "cmisaction" : "deleteTree"}
+        props = {"objectId": self.id,
+                 "cmisaction": "deleteTree"}
 
         # invoke the URL
         result = self._cmisClient.binding.post(delUrl.encode('utf-8'),
@@ -2266,13 +2276,13 @@ class BrowserFolder(BrowserCmisObject):
         The following optional arguments are NOT supported:
          - allVersions
         """
-        #TODO need to add support (and unit test) for allVersions
+        # TODO need to add support (and unit test) for allVersions
 
         addUrl = self._repository.getRootFolderUrl()
 
-        props = {"folderId" : self.id,
-                 "cmisaction" : "addObjectToFolder",
-                 "objectId" : cmisObject.id}
+        props = {"folderId": self.id,
+                 "cmisaction": "addObjectToFolder",
+                 "objectId": cmisObject.id}
 
         # invoke the URL
         result = self._cmisClient.binding.post(addUrl.encode('utf-8'),
@@ -2292,9 +2302,9 @@ class BrowserFolder(BrowserCmisObject):
 
         remUrl = self._repository.getRootFolderUrl()
 
-        props = {"folderId" : self.id,
-                 "cmisaction" : "removeObjectFromFolder",
-                 "objectId" : cmisObject.id}
+        props = {"folderId": self.id,
+                 "cmisaction": "removeObjectFromFolder",
+                 "objectId": cmisObject.id}
 
         # invoke the URL
         result = self._cmisClient.binding.post(remUrl.encode('utf-8'),
@@ -2326,7 +2336,7 @@ class BrowserRelationship(CmisObject):
         """
         Returns the :class:`CmisId` on the source side of the relationship.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getTargetId(self):
@@ -2334,7 +2344,7 @@ class BrowserRelationship(CmisObject):
         """
         Returns the :class:`CmisId` on the target side of the relationship.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getSource(self):
@@ -2343,7 +2353,7 @@ class BrowserRelationship(CmisObject):
         Returns an instance of the appropriate child-type of :class:`CmisObject`
         for the source side of the relationship.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getTarget(self):
@@ -2352,7 +2362,7 @@ class BrowserRelationship(CmisObject):
         Returns an instance of the appropriate child-type of :class:`CmisObject`
         for the target side of the relationship.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     sourceId = property(getSourceId)
@@ -2535,9 +2545,9 @@ class BrowserObjectType(object):
         kwargs['cmisselector'] = 'typeDefinition'
         kwargs['typeId'] = self.getTypeId()
         result = self._cmisClient.binding.get(typesUrl,
-                                                   self._cmisClient.username,
-                                                   self._cmisClient.password,
-                                                   **kwargs)
+                                              self._cmisClient.username,
+                                              self._cmisClient.password,
+                                              **kwargs)
         self.data = result
 
     id = property(getTypeId)
@@ -2687,7 +2697,7 @@ class BrowserACL(ACL):
                 # append it to the dictionary
                 result[principalId] = ace
         return result
-            
+
     def addEntry(self, principalId, access, direct):
 
         """
@@ -2805,14 +2815,14 @@ class BrowserChangeEntry(object):
         """
         Returns the unique ID of the change entry.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getObjectId(self):
         """
         Returns the object ID of the object that changed.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getChangeType(self):
@@ -2826,7 +2836,7 @@ class BrowserChangeEntry(object):
          - deleted
          - security
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getACL(self):
@@ -2834,7 +2844,7 @@ class BrowserChangeEntry(object):
         """
         Gets the :class:`ACL` object that is included with this Change Entry.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getChangeTime(self):
@@ -2842,7 +2852,7 @@ class BrowserChangeEntry(object):
         """
         Returns a datetime object representing the time the change occurred.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     def getProperties(self):
@@ -2852,7 +2862,7 @@ class BrowserChangeEntry(object):
         capabilities of the repository ("capabilityChanges") the list may not
         include the actual property values that changed.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
     id = property(getId)
@@ -2899,7 +2909,7 @@ class BrowserChangeEntryResultSet(Result
         """
         Overriding to make it work with a list instead of a dict.
         """
-        #TODO need to implement
+        # TODO need to implement
         pass
 
 
@@ -2977,6 +2987,7 @@ class BrowserCmisId(str):
 
     pass
 
+
 def getSpecializedObject(obj, **kwargs):
 
     """
@@ -3003,6 +3014,7 @@ def getSpecializedObject(obj, **kwargs):
     # types, give the object back
     return obj
 
+
 def encode_multipart_formdata(fields, file, contentType):
     """
     fields is a sequence of (name, value) elements for regular form fields.
@@ -3029,7 +3041,7 @@ def encode_multipart_formdata(fields, fi
         L.append('Content-Type: %s' % contentType)
         L.append('Content-Transfer-Encoding: binary')
         L.append('')
-        L.append(file.read()) # content of file goes here
+        L.append(file.read())
 
     L.append('--' + boundary + '--')
     L.append('')
@@ -3096,7 +3108,7 @@ class TreeSerializer(object):
 
             try:
                 dataObj = obj['children']
-                #if obj['object'].has_key('children'):
+                # if obj['object'].has_key('children'):
                 #    for child in obj['object']['children']:
                 childEntries = self.getEntries(client, repo, dataObj)
                 entries = entries + childEntries

Modified: chemistry/cmislib/trunk/src/cmislib/cmis_services.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/cmis_services.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/cmis_services.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/cmis_services.py Fri May 16 21:46:51 2014
@@ -24,6 +24,7 @@ from cmislib.exceptions import CmisExcep
     PermissionDeniedException, NotSupportedException, \
     UpdateConflictException
 
+
 class Binding(object):
     def getRepositoryService(self):
         pass

Modified: chemistry/cmislib/trunk/src/cmislib/domain.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/domain.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/domain.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/domain.py Fri May 16 21:46:51 2014
@@ -23,6 +23,7 @@ import logging
 
 moduleLogger = logging.getLogger('cmislib.domain')
 
+
 class CmisObject(object):
 
     """
@@ -47,7 +48,7 @@ class CmisObject(object):
         """
 
         pass
-    
+
     def getObjectId(self):
 
         """
@@ -359,7 +360,7 @@ class Repository(object):
         """
 
         pass
-    
+
     def getRepositoryName(self):
 
         """
@@ -1382,6 +1383,7 @@ class Document(CmisObject):
 
         pass
 
+
 class Folder(CmisObject):
 
     """
@@ -1435,7 +1437,7 @@ class Folder(CmisObject):
         pass
 
     def createDocument(self, name, properties={}, contentFile=None,
-            contentType=None, contentEncoding=None):
+                       contentType=None, contentEncoding=None):
 
         """
         Creates a new Document object in the repository using
@@ -1623,7 +1625,7 @@ class Folder(CmisObject):
         """
 
         pass
-    
+
     def getPaths(self):
         """
         Returns the paths as a list of strings. The spec says folders cannot

Modified: chemistry/cmislib/trunk/src/cmislib/model.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/model.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/model.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/model.py Fri May 16 21:46:51 2014
@@ -29,6 +29,7 @@ from cmis_services import Binding
 
 moduleLogger = logging.getLogger('cmislib.model')
 
+
 class CmisClient(object):
 
     """
@@ -99,6 +100,5 @@ class CmisClient(object):
 
         return self.binding.getRepositoryService().getDefaultRepository(self)
 
-
     defaultRepository = property(getDefaultRepository)
-    repositories = property(getRepositories)
+    repositories = property(getRepositories)
\ No newline at end of file

Modified: chemistry/cmislib/trunk/src/cmislib/net.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/net.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/net.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/net.py Fri May 16 21:46:51 2014
@@ -26,6 +26,7 @@ from urllib import urlencode
 import logging
 import httplib2
 
+
 class RESTService(object):
 
     """

Modified: chemistry/cmislib/trunk/src/cmislib/util.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/util.py?rev=1595362&r1=1595361&r2=1595362&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/util.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/util.py Fri May 16 21:46:51 2014
@@ -27,6 +27,7 @@ from cmislib.domain import CmisId, Docum
 
 moduleLogger = logging.getLogger('cmislib.util')
 
+
 def multiple_replace(aDict, text):
 
     """
@@ -42,6 +43,7 @@ def multiple_replace(aDict, text):
     # For each match, look-up corresponding value in dictionary
     return regex.sub(lambda mo: aDict[mo.string[mo.start():mo.end()]], text)
 
+
 def parsePropValue(value, nodeName):
 
     """
@@ -63,12 +65,13 @@ def parsePropValue(value, nodeName):
     elif nodeName == 'propertyDecimal':
         return float(value)
     elif nodeName == 'propertyDateTime':
-        #%z doesn't seem to work, so I'm going to trunc the offset
-        #not all servers return microseconds, so those go too
+        # %z doesn't seem to work, so I'm going to trunc the offset
+        # not all servers return microseconds, so those go too
         return parseDateTimeValue(value)
     else:
         return value
 
+
 def parsePropValueByType(value, typeName):
 
     """
@@ -86,7 +89,6 @@ def parsePropValueByType(value, typeName
     elif typeName == 'string':
         return value
     elif typeName == 'boolean':
-        #TODO
         if not value:
             return False
         if type(value) == bool:
@@ -110,12 +112,13 @@ def parsePropValueByType(value, typeName
         else:
             return 0.0
     elif typeName == 'datetime':
-        #%z doesn't seem to work, so I'm going to trunc the offset
-        #not all servers return microseconds, so those go too
+        # %z doesn't seem to work, so I'm going to trunc the offset
+        # not all servers return microseconds, so those go too
         return parseDateTimeValue(value)
     else:
         return value
 
+
 def parseDateTimeValue(value):
 
     """
@@ -124,10 +127,11 @@ def parseDateTimeValue(value):
     if type(value) == str:
         return iso8601.parse_date(value)
     elif type(value) == int:
-        return datetime.datetime.fromtimestamp(value/1000)
+        return datetime.datetime.fromtimestamp(value / 1000)
     else:
         return
 
+
 def parseBoolValue(value):
 
     """
@@ -150,13 +154,11 @@ def toCMISValue(value):
     Utility function to convert Python values to CMIS string values
     """
 
-    if value == False:
+    if value is False:
         return 'false'
-    elif value == True:
+    elif value is True:
         return 'true'
     elif value is None:
         return 'none'
     else:
-        return value
-
-
+        return value
\ No newline at end of file



Mime
View raw message