Chris Glass has proposed merging lp:~tribaal/txaws/fix-965915 into lp:txaws.

Requested reviews:
  txAWS Technical List (txaws-tech)

For more details, see:
https://code.launchpad.net/~tribaal/txaws/fix-965915/+merge/99498

This fixes bug 965915, introduced in the previous commit.

Basically clouddeck expects to receive a specific Exception type (APIError), 
and the previous change made passing a string to Integer types raise a 
ValueError instead.
-- 
https://code.launchpad.net/~tribaal/txaws/fix-965915/+merge/99498
Your team txAWS Technical List is requested to review the proposed merge of 
lp:~tribaal/txaws/fix-965915 into lp:txaws.
=== modified file 'txaws/server/schema.py'
--- txaws/server/schema.py	2012-03-26 10:02:58 +0000
+++ txaws/server/schema.py	2012-03-27 11:56:30 +0000
@@ -93,8 +93,8 @@
             if not self.allow_none:
                 raise MissingParameterError(self.name)
             return self.default
-        self._check_range(value)
         try:
+            self._check_range(value)
             parsed = self.parse(value)
             if self.validator and not self.validator(parsed):
                 raise ValueError(value)

=== modified file 'txaws/server/tests/test_schema.py'
--- txaws/server/tests/test_schema.py	2012-03-26 10:02:58 +0000
+++ txaws/server/tests/test_schema.py	2012-03-27 11:56:30 +0000
@@ -281,6 +281,14 @@
         self.assertEqual(400, error.status)
         self.assertEqual("InvalidParameterValue", error.code)
 
+    def test_non_integer_string(self):
+        garbage = "blah"
+        parameter = Integer("Test")
+        error = self.assertRaises(APIError, parameter.coerce, garbage)
+        self.assertEqual(400, error.status)
+        self.assertEqual("InvalidParameterValue", error.code)
+        self.assertIn("Invalid integer value %s" % garbage, error.message)
+
 
 class BoolTestCase(TestCase):
 

_______________________________________________
Mailing list: https://launchpad.net/~txaws-dev
Post to     : txaws-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~txaws-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to