Commits

benoitc  committed 59e19f3

fix warning on py26 & bump version number

  • Participants
  • Parent commits 013d562
  • Tags 1.2.2

Comments (0)

Files changed (4)

File docs/index.txt

 
 .. rubric:: Everything you need to know about py-restclient.
 
-**Py-restclient** is simple **REST client for Python**, inspired bythe
+**Py-restclient** is simple **REST client for Python**, inspired by the
 microframework (Camping, Sinatra) style of specifying actions: get, head, put, post, delete. 
 
 Made by `Enki Multimedia <http://www.e-engura.org>`_ for one of our project and we decided to make it public.

File restclient/rest.py

 
 __all__ = ['Resource', 'RestClient', 'ResourceNotFound', \
         'Unauthorized', 'RequestFailed', 'ResourceError',
-        'RequestError']
+        'RequestError', 'url_quote', 'url_encode']
 
 __docformat__ = 'restructuredtext en'
 
 class ResourceError(Exception):
+    
+    _message = None
+    
     def __init__(self, message=None, http_code=None, response=None):
         self.message = message
         self.status_code = http_code
         self.response = response
+        
 
+    @apply
+    def message():
+
+        def get(self):
+            return self._message
+
+        def set(self, value):
+            self._message = value
+
+        return property(get, set)
+        
 class ResourceNotFound(ResourceError):
     """Exception raised when no resource was found at the given url. 
     """
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-import ez_setup
-ez_setup.use_setuptools()
 
-from setuptools import setup, find_packages
+try:
+    from setuptools import setup, find_packages
+except ImportError:
+    import ez_setup
+    ez_setup.use_setuptools()
+    from setuptools import setup, find_packages
 
 import sys
 
 setup(
     name = 'py-restclient',
-    version = '1.2.1',
+    version = '1.2.2',
     description = 'Python REST client',
     long_description = \
 """A simple REST client for Python, inspired by the microframework (Camping, Sinatra) style of specifying actions: get, put, post, delete.""",

File tests/transports_test.py

                 headers={'Content-Type': 'application/json'})
         self.assert_(self.res.response.status == 200 )
         def bad_post():
-            result = self.res.post('/json', payload="test",
+            result = self.res.post('/json', payload="test", 
                     headers={'Content-Type': 'text/plain'})
         self.assertRaises(RequestFailed, bad_post)