PendingDeprecationWarning on django / tastypie

荒凉一梦 提交于 2020-01-05 02:30:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!