我正在尝试使用tastypie设置一个非常简单的REST服务示例,但是我得到了PendingDeprecationWarning。
以下是浏览器上显示的错误消息
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']
我正在使用tastypie 0.11.0
没有太多关于此错误的文档或其他报告(警告而是),所以我想询问有关如何进行此操作的建议。
答案 0 :(得分:11)
问题似乎可以通过在tastypie的文件resources.py文件中更改patch_list()
方法(第2190行)的装饰器来解决
来自@transaction.commit_on_success()
到@transaction.atomic()