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 2010/11/23 20:14:34 UTC

svn commit: r1038288 - in /incubator/chemistry/cmislib/trunk/src: cmislib/ doc/src/ tests/

Author: jpotts
Date: Tue Nov 23 19:14:34 2010
New Revision: 1038288

URL: http://svn.apache.org/viewvc?rev=1038288&view=rev
Log:
Applied CMIS-279 patch, created a test for CMIS-279, added Apache license banner to doc source

Modified:
    incubator/chemistry/cmislib/trunk/src/cmislib/model.py
    incubator/chemistry/cmislib/trunk/src/doc/src/about.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/code.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/conf.py
    incubator/chemistry/cmislib/trunk/src/doc/src/devguide.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/docs.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/examples.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/index.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/install.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/sample-data.rst
    incubator/chemistry/cmislib/trunk/src/doc/src/tests.rst
    incubator/chemistry/cmislib/trunk/src/tests/cmislibtest.py

Modified: incubator/chemistry/cmislib/trunk/src/cmislib/model.py
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/cmislib/model.py?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/cmislib/model.py (original)
+++ incubator/chemistry/cmislib/trunk/src/cmislib/model.py Tue Nov 23 19:14:34 2010
@@ -1020,9 +1020,9 @@ class Repository(object):
         xmlDoc = self._getQueryXmlDoc(statement, **kwargs)
 
         # do the POST
-        #print 'posting:%s' % xmlDoc.toxml()
+        #print 'posting:%s' % xmlDoc.toxml(encoding='utf-8')
         result = self._cmisClient.post(queryUrl,
-                                       xmlDoc.toxml(),
+                                       xmlDoc.toxml(encoding='utf-8'),
                                        CMIS_QUERY_TYPE)
         if type(result) == HTTPError:
             raise CmisException(result.code)
@@ -1862,7 +1862,7 @@ class CmisObject(object):
 
         # do a PUT of the entry
         updatedXmlDoc = self._cmisClient.put(selfUrl,
-                                             xmlEntryDoc.toxml(),
+                                             xmlEntryDoc.toxml(encoding='utf-8'),
                                              ATOM_XML_TYPE)
 
         # reset the xmlDoc for this object with what we got back from
@@ -1951,7 +1951,7 @@ class CmisObject(object):
         assert url != None, 'Could not determine relationships URL'
 
         result = self._cmisClient.post(url,
-                                       xmlDoc.toxml(),
+                                       xmlDoc.toxml(encoding='utf-8'),
                                        ATOM_XML_TYPE)
 
         if type(result) == HTTPError:
@@ -2075,7 +2075,7 @@ class CmisObject(object):
                 raise CmisException('The ACL to apply must be an instance of the ACL class.')
             aclUrl = self._getLink(ACL_REL)
             assert aclUrl, "Could not determine the object's ACL URL."
-            result = self._cmisClient.put(aclUrl, acl.getXmlDoc().toxml(), CMIS_ACL_TYPE)
+            result = self._cmisClient.put(aclUrl, acl.getXmlDoc().toxml(encoding='utf-8'), CMIS_ACL_TYPE)
             if type(result) == HTTPError:
                 raise CmisException(result.code)
             return ACL(xmlDoc=result)
@@ -2244,33 +2244,33 @@ class CmisObject(object):
                     if isList:
                         propValueStrList = []
                         for val in propValue:
-                            propValueStrList.append(str(val).lower())
+                            propValueStrList.append(unicode(val).lower())
                     else:
-                        propValueStrList = [str(propValue).lower()]
+                        propValueStrList = [unicode(propValue).lower()]
                 elif (propType == int):
                     propElementName = 'cmis:propertyInteger'
                     if isList:
                         propValueStrList = []
                         for val in propValue:
-                            propValueStrList.append(str(val))
+                            propValueStrList.append(unicode(val))
                     else:
-                        propValueStrList = [str(propValue)]
+                        propValueStrList = [unicode(propValue)]
                 elif (propType == float):
                     propElementName = 'cmis:propertyDecimal'
                     if isList:
                         propValueStrList = []
                         for val in propValue:
-                            propValueStrList.append(str(val))
+                            propValueStrList.append(unicode(val))
                     else:
-                        propValueStrList = [str(propValue)]
+                        propValueStrList = [unicode(propValue)]
                 else:
                     propElementName = 'cmis:propertyString'
                     if isList:
                         propValueStrList = []
                         for val in propValue:
-                            propValueStrList.append(str(val))
+                            propValueStrList.append(unicode(val))
                     else:
-                        propValueStrList = [str(propValue)]
+                        propValueStrList = [unicode(propValue)]
 
                 propElement = entryXmlDoc.createElementNS(CMIS_NS, propElementName)
                 propElement.setAttribute('propertyDefinitionId', propName)
@@ -2326,7 +2326,7 @@ class Document(CmisObject):
 
         # post it to to the checkedout collection URL
         result = self._cmisClient.post(checkoutUrl,
-                                       entryXmlDoc.toxml(),
+                                       entryXmlDoc.toxml(encoding='utf-8'),
                                        ATOM_XML_ENTRY_TYPE)
 
         if type(result) == HTTPError:
@@ -2449,7 +2449,7 @@ class Document(CmisObject):
         # Get the self link
         # Do a PUT of the empty ATOM to the self link
         url = self._getSelfLink()
-        result = self._cmisClient.put(url, entryXmlDoc.toxml(), ATOM_XML_TYPE, **kwargs)
+        result = self._cmisClient.put(url, entryXmlDoc.toxml(encoding='utf-8'), ATOM_XML_TYPE, **kwargs)
 
         if type(result) == HTTPError:
             raise CmisException(result.code)
@@ -2711,7 +2711,7 @@ class Folder(CmisObject):
 
         # post the Atom entry
         result = self._cmisClient.post(postUrl,
-                                       entryXml.toxml(),
+                                       entryXml.toxml(encoding='utf-8'),
                                        ATOM_XML_ENTRY_TYPE)
         if type(result) == HTTPError:
             raise CmisException(result.code)
@@ -2781,7 +2781,7 @@ class Folder(CmisObject):
                                       contentType, contentEncoding)
 
         # post the Atom entry
-        result = self._cmisClient.post(postUrl, xmlDoc.toxml(), ATOM_XML_ENTRY_TYPE)
+        result = self._cmisClient.post(postUrl, xmlDoc.toxml(encoding='utf-8'), ATOM_XML_ENTRY_TYPE)
         if type(result) == HTTPError:
             raise CmisException(result.code)
 

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/about.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/about.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/about.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/about.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 About the CMIS Python Library
 =============================
 The goal of this project is to create a CMIS client for Python that can be used to work with any CMIS-compliant repository.
@@ -45,4 +58,4 @@ Policies
  * createPolicy
  * applyPolicy
  * removePolicy
- * getAppliedPolicies
\ No newline at end of file
+ * getAppliedPolicies

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/code.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/code.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/code.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/code.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Code
 ====
 
@@ -35,4 +48,4 @@ The :mod:`tests.cmislib` Module
 The :mod:`tests.cmislibtest` Module contains unit tests for all classes and methods in :mod:`cmislib.model`. See :ref:`tests` for more information on running tests.
 
 .. automodule:: tests.cmislibtest
-   :members:
\ No newline at end of file
+   :members:

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/conf.py
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/conf.py?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/conf.py (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/conf.py Tue Nov 23 19:14:34 2010
@@ -1,5 +1,17 @@
 # -*- coding: utf-8 -*-
 #
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
 # CMIS Library documentation build configuration file, created by
 # sphinx-quickstart on Thu Dec 10 10:12:43 2009.
 #
@@ -45,9 +57,9 @@ copyright = u'2010, Apache Software Foun
 # built documents.
 #
 # The short X.Y version.
-version = '0.3'
+version = '0.4'
 # The full version, including alpha/beta/rc tags.
-release = '0.3dev'
+release = '0.4dev'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/devguide.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/devguide.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/devguide.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/devguide.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 ===============
 Developer Guide
 ===============

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/docs.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/docs.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/docs.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/docs.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Documentation
 =============
 

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/examples.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/examples.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/examples.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/examples.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. _examples:
 
 ========

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/index.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/index.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/index.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/index.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. CMIS Library documentation master file, created by
    sphinx-quickstart on Thu Dec 10 10:12:43 2009.
    You can adapt this file completely to your liking, but it should at least

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/install.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/install.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/install.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/install.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Installation
 ============
 
@@ -20,4 +33,4 @@ Once you do that, you should be able to 
 
   >>> from cmislib.model import CmisClient, Repository, Folder
 
-To validate everything is working, run some :ref:`tests` or walk through some :ref:`examples`.
\ No newline at end of file
+To validate everything is working, run some :ref:`tests` or walk through some :ref:`examples`.

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/sample-data.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/sample-data.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/sample-data.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/sample-data.rst Tue Nov 23 19:14:34 2010
@@ -1,6 +1,19 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Sample Data
 ===========
 
 The /path/to/cmislib/src/data directory contains some sample XML responses from a CMIS service. These are for sample and development purposes and can safely be ignored if you are an end-user of the library.
 
-In some cases there are two files for the same response. For example, 'types.xml' came from Alfresco while 'types.chemistry.xml' came from the simple Apache Chemistry test server.
\ No newline at end of file
+In some cases there are two files for the same response. For example, 'types.xml' came from Alfresco while 'types.chemistry.xml' came from the simple Apache Chemistry test server.

Modified: incubator/chemistry/cmislib/trunk/src/doc/src/tests.rst
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/doc/src/tests.rst?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/doc/src/tests.rst (original)
+++ incubator/chemistry/cmislib/trunk/src/doc/src/tests.rst Tue Nov 23 19:14:34 2010
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. _tests:
 
 =====

Modified: incubator/chemistry/cmislib/trunk/src/tests/cmislibtest.py
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/tests/cmislibtest.py?rev=1038288&r1=1038287&r2=1038288&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/tests/cmislibtest.py (original)
+++ incubator/chemistry/cmislib/trunk/src/tests/cmislibtest.py Tue Nov 23 19:14:34 2010
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -14,6 +15,7 @@
 #   Authors:
 #    Jeff Potts, Optaros
 #
+
 '''
 Unit tests for cmislib
 '''
@@ -250,6 +252,13 @@ class RepositoryTest(CmisTestBase):
         newDoc = self._repo.createDocument(documentName, parentFolder=self._testFolder)
         self.assertEquals(documentName, newDoc.getName())
 
+    # CMIS-279
+    def testCreateDocumentUnicode(self):
+        '''Create a new doc with unicode characters in the name'''
+        documentName = u'abc cdeöäüß%§-_caféè.txt'
+        newDoc = self._repo.createDocument(documentName, parentFolder=self._testFolder)
+        self.assertEquals(documentName, newDoc.getName())
+
     def testGetObject(self):
         '''Create a test folder then attempt to retrieve it as a
         :class:`CmisObject` object using its object ID'''