问题
I am trying to set a pretty straightforward example of a REST service using tastypie, however I am getting a PendingDeprecationWarning.
Here is the error message appearing on the browser
Request Method: GET
Request URL: http://127.0.0.1:8000/myapp/api/myapp_resource
Django Version: 1.6.2
Exception Type: PendingDeprecationWarning
Exception Value:
commit_on_success is deprecated in favor of atomic.
Exception Location: /home/pkaramol/Workspace/django-env/lib/python3.3/site-packages/django/db/transaction.py in commit_on_success, line 448
Python Executable: /home/pkaramol/Workspace/django-env/bin/python3
Python Version: 3.3.2
Python Path:
['/home/pkaramol/Workspace/django-env/restserver',
'/home/pkaramol/Workspace/django-env/lib/python3.3',
'/home/pkaramol/Workspace/django-env/lib/python3.3/plat-x86_64-linux-gnu',
'/home/pkaramol/Workspace/django-env/lib/python3.3/lib-dynload',
'/usr/lib/python3.3',
'/usr/lib/python3.3/plat-x86_64-linux-gnu',
'/home/pkaramol/Workspace/django-env/lib/python3.3/site-packages']
I am using tastypie 0.11.0
There is not much of a documentation or other reports regarding this error (warning rather) so I would like to ask for suggestions on how to go about it.
回答1:
Problem seems to be solved by changing the decorator of patch_list()
method (line 2190) in file resources.py file of tastypie
from @transaction.commit_on_success()
to @transaction.atomic()
来源:https://stackoverflow.com/questions/22510756/pendingdeprecationwarning-on-django-tastypie