chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpo...@apache.org
Subject svn commit: r1595102 - in /chemistry/cmislib/trunk/src/cmislib/browser: binding.py serializers.py
Date Fri, 16 May 2014 04:43:46 GMT
Author: jpotts
Date: Fri May 16 04:43:45 2014
New Revision: 1595102

URL: http://svn.apache.org/r1595102
Log:
testGetAllVersions and testGetLatestVersion now passing in cmislib; removing serializers.py,
those live in the binding class for now

Removed:
    chemistry/cmislib/trunk/src/cmislib/browser/serializers.py
Modified:
    chemistry/cmislib/trunk/src/cmislib/browser/binding.py

Modified: chemistry/cmislib/trunk/src/cmislib/browser/binding.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/cmislib/browser/binding.py?rev=1595102&r1=1595101&r2=1595102&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/browser/binding.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/browser/binding.py Fri May 16 04:43:45 2014
@@ -1734,7 +1734,13 @@ class BrowserDocument(BrowserCmisObject)
         u'2.0'
         """
 
-        pass
+        doc = None
+        if kwargs.has_key('major') and kwargs['major'] == 'true':
+            doc = self._repository.getObject(self.getObjectId(), returnVersion='latestmajor')
+        else:
+            doc = self._repository.getObject(self.getObjectId(), returnVersion='latest')
+
+        return doc
 
     def getPropertiesOfLatestVersion(self, **kwargs):
 
@@ -1767,7 +1773,7 @@ class BrowserDocument(BrowserCmisObject)
                                               **kwargs)
 
         # return the result set
-        return BrowserResultSet(self._cmisClient, self._repository, data={'objects': result})
+        return BrowserResultSet(self._cmisClient, self._repository, data={'objects': result},
serializer=VersionsSerializer())
 
     def getContentStream(self):
 
@@ -2969,6 +2975,18 @@ class ChildrenSerializer(object):
         return entries
 
 
+class VersionsSerializer(object):
+    def fromJSON(self, client, repo, jsonObj):
+        entries = []
+        for obj in jsonObj['objects']:
+            cmisObject = getSpecializedObject(BrowserCmisObject(client,
+                                                                repo,
+                                                                data=obj))
+            entries.append(cmisObject)
+
+        return entries
+
+
 class TreeSerializer(object):
     '''
     The AtomPubBinding may be returning descendants and trees as a flat list of results.
@@ -2997,4 +3015,12 @@ class TreeSerializer(object):
             except KeyError:
                 pass
 
-        return entries
\ No newline at end of file
+        return entries
+
+
+class FolderSerializer(object):
+    def fromJSON(self, client, repo, jsonString):
+        obj = json.loads(jsonString)
+        objectId = obj['succinctProperties']['cmis:objectId']
+        folder = BrowserFolder(client, repo, objectId, properties=obj['succinctProperties'])
+        return folder
\ No newline at end of file



Mime
View raw message