Permalink
Browse files

Merge branch 'release/2.0.6'

  • Loading branch information...
2 parents aa3df89 + f26ae0e commit cd5932373441450e67f8e54b661fb83dbdef3ab4 @klen committed Nov 19, 2012
Showing with 21 additions and 2 deletions.
  1. +4 −0 Changelog
  2. +1 −1 adrest/__init__.py
  3. +3 −0 adrest/resources/rpc.py
  4. +3 −0 tests/rpc/tests.py
  5. +7 −0 tests/simple/api.py
  6. +3 −1 tests/simple/tests.py
View
@@ -1,3 +1,7 @@
+2012-11-19 klen 2.0.6
+
+ * Fix OPTIONS method in RPC calls
+
2012-11-13 klen 2.0.5
* Fix serialization errors
View
@@ -1,4 +1,4 @@
-version_info = (2, 0, 5)
+version_info = (2, 0, 6)
__version__ = version = '.'.join(map(str, version_info))
__project__ = PROJECT = __name__
@@ -39,6 +39,9 @@ def configure_rpc(self, scheme):
self.methods[m.__name__] = m
def handle_request(self, request, **resources):
+ if request.method == 'OPTIONS':
+ return super(RPCResource, self).handle_request(request, **resources)
+
payload = request.data
try:
View
@@ -20,6 +20,9 @@ def setUp(self):
def test_base_rpc(self):
+ response = self.get_resource('rpc2', method='options')
+ self.assertEqual(response.content, 'OK')
+
# POST args
response = self.rpc(
'rpc2',
View
@@ -9,5 +9,12 @@ class TaskResource(ResourceView):
emitters = emitter.XMLTemplateEmitter
+class Task2Resource(ResourceView):
+ allowed_methods = 'GET', 'POST'
+ emitters = emitter.JSONEmitter
+ model = Task
+
+
API = Api(version='1.0b')
API.register(TaskResource)
+API.register(Task2Resource, url_name='task2', url_regex='task2')
@@ -15,6 +15,9 @@ def test_base(self):
response = self.get_resource('task')
self.assertContains(response, 'true')
+ response = self.post_resource('task2', data=dict(title='new'))
+ self.assertEqual(response.content, '{"user": ["This field is required."]}')
+
class SerializerTest(TestCase):
@@ -46,7 +49,6 @@ def test_simply(self):
self.assertEquals(task['fields']['user'], user.pk)
self.assertTrue('title' in task['fields'].keys())
-
def test_xml(self):
from adrest.utils.serializer import XMLSerializer
from ..main.models import Book

0 comments on commit cd59323

Please sign in to comment.