You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by jp...@apache.org on 2014/05/04 21:44:07 UTC

svn commit: r1592412 - in /chemistry/cmislib/trunk/src: cmislib/browser/binding.py tests/cmislibtest.py tests/settings.py

Author: jpotts
Date: Sun May  4 19:44:07 2014
New Revision: 1592412

URL: http://svn.apache.org/r1592412
Log:
Small tweak to how extArgs is handled, removed getCollection from unit tests because it is binding specific, fixed references in browser binding logger

Modified:
    chemistry/cmislib/trunk/src/cmislib/browser/binding.py
    chemistry/cmislib/trunk/src/tests/cmislibtest.py
    chemistry/cmislib/trunk/src/tests/settings.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=1592412&r1=1592411&r2=1592412&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/cmislib/browser/binding.py (original)
+++ chemistry/cmislib/trunk/src/cmislib/browser/binding.py Sun May  4 19:44:07 2014
@@ -142,8 +142,8 @@ class BrowserCmisObject(object):
         self._properties = {}
         self._allowableActions = {}
         self.data = data
-        self._kwargs = kwargs
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserCmisObject')
+        self._extArgs = kwargs
+        self.logger = logging.getLogger('cmislib.browser.BrowserCmisObject')
         self.logger.info('Creating an instance of CmisObject')
 
     def __str__(self):
@@ -173,11 +173,8 @@ class BrowserCmisObject(object):
         '*'.
         """
 
-        if kwargs:
-            if self._kwargs:
-                self._kwargs.update(kwargs)
-            else:
-                self._kwargs = kwargs
+        if self._extArgs:
+            kwargs.update(self._extArgs)
 
         byObjectIdUrl = self._repository.getRootFolderUrl() + "?objectId=" + self.getObjectId() + "&cmisselector=object"
         self.data = self._cmisClient.binding.get(byObjectIdUrl.encode('utf-8'),
@@ -520,7 +517,7 @@ class BrowserRepository(object):
         self._permMap = {}
         self._permissions = None
         self._propagation = None
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserRepository')
+        self.logger = logging.getLogger('cmislib.browser.BrowserRepository')
         self.logger.info('Creating an instance of Repository')
 
     def __str__(self):
@@ -648,10 +645,10 @@ class BrowserRepository(object):
         """
 
         if kwargs:
-            if self._kwargs:
-                self._kwargs.update(kwargs)
+            if self._extArgs:
+                self._extArgs.update(kwargs)
             else:
-                self._kwargs = kwargs
+                self._extArgs = kwargs
 
         #TODO why is quoting the path required for the browser binding and not for atom pub
         #on inmemory 0.9?
@@ -1227,8 +1224,8 @@ class BrowserRepository(object):
 
         propCount = 2
         for prop in properties:
-            props["propertyId[%s]" % propCount] = prop.key
-            props["propertyValue[%s]" % propCount] = prop
+            props["propertyId[%s]" % propCount] = prop
+            props["propertyValue[%s]" % propCount] = properties[prop]
             propCount += 1
 
         contentType, body = encode_multipart_formdata(props, contentFile, contentType)
@@ -1332,7 +1329,7 @@ class BrowserResultSet(object):
         self._repository = repository
         self._data = data
         self._results = []
-        self.logger = logging.getLogger('cmislib.model.browser_binding.BrowserResultSet')
+        self.logger = logging.getLogger('cmislib.browser.BrowserResultSet')
         self.logger.info('Creating an instance of ResultSet')
 
     def __iter__(self):
@@ -2266,10 +2263,10 @@ class BrowserObjectType(object):
         """ Constructor """
         self._cmisClient = cmisClient
         self._repository = repository
-        self._kwargs = None
+        self._extArgs = None
         self._typeId = typeId
         self.data = data
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserObjectType')
+        self.logger = logging.getLogger('cmislib.browser.BrowserObjectType')
         self.logger.info('Creating an instance of BrowserObjectType')
 
     def __str__(self):
@@ -2412,10 +2409,8 @@ class BrowserObjectType(object):
         This method will reload the object's data from the CMIS service.
         """
         if kwargs:
-            if self._kwargs:
-                self._kwargs.update(kwargs)
-            else:
-                self._kwargs = kwargs
+            if self._extArgs:
+                kwargs.update(self._extArgs)
 
         typesUrl = self._repository.getRepositoryUrl()
         kwargs['cmisselector'] = 'typeDefinition'
@@ -2453,7 +2448,7 @@ class BrowserProperty(object):
     def __init__(self, data):
         """Constructor"""
         self.data = data
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserProperty')
+        self.logger = logging.getLogger('cmislib.browser.BrowserProperty')
         self.logger.info('Creating an instance of BrowserProperty')
 
     def __str__(self):
@@ -2556,7 +2551,7 @@ class BrowserACL(object):
         else:
             self._data = None
 
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserACL')
+        self.logger = logging.getLogger('cmislib.browser.BrowserACL')
         self.logger.info('Creating an instance of ACL')
 
     def _getEntriesFromData(self):
@@ -2795,7 +2790,7 @@ class BrowserRendition(object):
     def __init__(self, propNode):
         """Constructor"""
         self.xmlDoc = propNode
-        self.logger = logging.getLogger('cmislib.browser_binding.BrowserRendition')
+        self.logger = logging.getLogger('cmislib.browser.BrowserRendition')
         self.logger.info('Creating an instance of Rendition')
 
     def __str__(self):

Modified: chemistry/cmislib/trunk/src/tests/cmislibtest.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/tests/cmislibtest.py?rev=1592412&r1=1592411&r2=1592412&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/tests/cmislibtest.py (original)
+++ chemistry/cmislib/trunk/src/tests/cmislibtest.py Sun May  4 19:44:07 2014
@@ -816,8 +816,6 @@ class DocumentTest(CmisTestBase):
             self.assertTrue(newDoc.isCheckedOut())
             self.assert_('cmis:objectId' in newDoc.getProperties())
             self.assert_('cmis:objectId' in pwcDoc.getProperties())
-            checkedOutDocs = self._repo.getCollection('checkedout')
-            self.assertTrue(isInResultSet(checkedOutDocs, pwcDoc))
         finally:
             pwcDoc.delete()
 
@@ -836,8 +834,6 @@ class DocumentTest(CmisTestBase):
             self.assertTrue(newDoc.isCheckedOut())
             self.assert_('cmis:objectId' in newDoc.getProperties())
             self.assert_('cmis:objectId' in pwcDoc.getProperties())
-            checkedOutDocs = self._repo.getCollection('checkedout')
-            self.assertTrue(isInResultSet(checkedOutDocs, pwcDoc))
         finally:
             pwcDoc.delete()
 
@@ -929,13 +925,9 @@ class DocumentTest(CmisTestBase):
             self.assertTrue(newDoc.isCheckedOut())
             self.assert_('cmis:objectId' in newDoc.getProperties())
             self.assert_('cmis:objectId' in pwcDoc.getProperties())
-            checkedOutDocs = self._repo.getCollection('checkedout')
-            self.assertTrue(isInResultSet(checkedOutDocs, pwcDoc))
         finally:
             pwcDoc.delete()
         self.assertFalse(newDoc.isCheckedOut())
-        checkedOutDocs = self._repo.getCollection('checkedout')
-        self.assertFalse(isInResultSet(checkedOutDocs, pwcDoc))
 
     def testDeleteDocument(self):
         """Create a document in a test folder, then delete it"""

Modified: chemistry/cmislib/trunk/src/tests/settings.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/tests/settings.py?rev=1592412&r1=1592411&r2=1592412&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/tests/settings.py (original)
+++ chemistry/cmislib/trunk/src/tests/settings.py Sun May  4 19:44:07 2014
@@ -24,16 +24,16 @@ from cmislib.browser.binding import Brow
 #
 # CMIS repository's service URL
 #REPOSITORY_URL = 'http://cmis.alfresco.com/s/cmis' # Alfresco demo
-REPOSITORY_URL = 'http://localhost:8081/chemistry/atom' # Apache Chemistry AtomPub
-#REPOSITORY_URL = 'http://localhost:8081/chemistry/browser' # Apache Chemistry Browser
+#REPOSITORY_URL = 'http://localhost:8081/chemistry/atom' # Apache Chemistry AtomPub
+REPOSITORY_URL = 'http://localhost:8081/chemistry/browser' # Apache Chemistry Browser
 #REPOSITORY_URL = 'http://localhost:8080/alfresco/cmisatom'  # Alfresco 4.0 AtomPub
 #REPOSITORY_URL = 'http://localhost:8080/alfresco/s/api/cmis'  # Alfresco
 #REPOSITORY_URL = 'http://cmis.demo.nuxeo.org/nuxeo/atom/cmis' # Nuxeo demo
 #REPOSITORY_URL = 'http://localhost:8080/nuxeo/atom/cmis' # Nuxeo local
 
 # Choose a binding. The AtomPubBinding is the only one you should really be using right now
-BINDING = AtomPubBinding()
-#BINDING = BrowserBinding()
+#BINDING = AtomPubBinding()
+BINDING = BrowserBinding()
 
 # CMIS repository credentials
 USERNAME = 'admin'  # Alfresco